p***7 发帖数: 535 | 1 data work.geo;
infile datalines;
input city $20.;
in city='Tulsa' then state='OK';
Region='Central';
if City='LA'then state='CA';
Region='western';
datalines;
Tulsa
LA
BANGOR;
RUN;
After data step execution, what will data set WORK.GEO contain?
The answer is blow
A
CITY STATE REGION
TULAS OK WESTERN
LA CA WESTERN
Bangor WESTERN
I could not understand it. I know there should be @ in the input statement.
but why all the regions are western?
Thanks so much |
o*******w 发帖数: 2310 | 2 你该先看书啊,这个很基本。
后边的REGION 相当于对REGION 的值的更新,所有的OBS 都是这个最新值。 |
p***7 发帖数: 535 | 3 I get it! I think I overlooked the semicolon before the regions.
Thanks! |
p***7 发帖数: 535 | 4 35
given the SAS DATA set SASDATA.TWO
X Y
-----
5 2
3 1
5 6
The program below is submitted
data sasuser.one sasuser.two other;
if x eq 5 then output sasuser.one;
if y lt 5 then output sasuser.two;
output;
run;
The answer is
A
sasuser.one has 5 observations
sasuser.two has 5 observations
work.other has 3 observations
Where is 5 observations from? total it is 3.
Thanks |
o*******w 发帖数: 2310 | 5 the "output" in the last line will output everything again to each dataset.
【在 p***7 的大作中提到】 : 35 : given the SAS DATA set SASDATA.TWO : X Y : ----- : 5 2 : 3 1 : 5 6 : The program below is submitted : data sasuser.one sasuser.two other; : if x eq 5 then output sasuser.one;
|
p***7 发帖数: 535 | |