data teng.narparks2 ;
infile 'C:\Users\Administrator\codes_sas\Parks.dat';
input name $1-21 type $ region $ museums camping;
run;
proc report nowindows missing headline;
column name type region museums camping facilities note;
define museums / sum ;
define camping / sum ;
define facilities / computed 'camping /and /museums';
compute facilities ;
facilities = museums.sum + camping.sum;
endcomp;
define note / computed ;
compute note / char length = 11;
if camping = 0 then note = 'no camping'; 书上写的是camping.sum = 0 ????
endcomp;
title 'addsdf3wrfdefds';
run;
按照书上写的camping.sum= o的话,我最后得到结果note是正常的,但是写成if camping = 0的话,输出结果在note 一行就全变成了 no camping。。想请教下高手,为什么会成这样?在report过程中,是不能利用源数据来进行if逻辑判断呢??
数据是这样的
name | type | region | museums | camping |
Dinosaur | NM | West | 2 | 6 |
Ellis Island | NM | East | 1 | 0 |
Everglades | NP | East | 5 | 2 |
Grand Canyon | NP | West | 5 | 3 |
Great Smoky Mountains | NP | East | 3 | 10 |
Hawaii Volcanoes | NP | West | 2 | 2 |
Lava Beds | NM | West | 1 | 1 |
Statue of Liberty | NM | East | 1 | 0 |
Theodore Roosevelt | NP | | 2 | 2 |
Yellowstone | NP | West | 9 | 11 |
Yosemite | NP | West | 2 | 13 |