j********t 发帖数: 201 | 1 While editing SAS Base Certificate Course, I found the following program
useful to organize your base SAS knowledge by one single "run".
If you are interested, run the following program, read the log file and try
to understand all the
contents in the log using what you've learnt about SAS. The key is to
understand how
SAS operates at its data step and data step carries SAS's real power.
hints:
1) what does _all_ means? How many variables you have created yourself? and
why there are some more?
2) what does PDV mean? How does the concept help to understand the data step?
3) What signals the beginning of data step? What signals the end of the data
step? How could you use the knowledge to control your code?
4) What signals the beginning of a group? What signals the end of a group?
5) What does _n_ mean? How to explain the last value of _n_ in the log?
data one;
input name $ month income;
cards;
cleo 12 4500
peter 11 4300
peter 12 4600
;
run;
proc sort;
by name ;
run;
data two;
put 'PUT 1: ' _all_ ;
set one end=x;
by name;
put 'PUT 2: ' _all_ ;
newname = name;
put 'PUT 3: ' _all_ ;
if last.name ;
put 'PUT 4: ' _all_ ;
Run ;
proc print;
run;
Now, if you believe you understand the program very well, then think the
following question: what is the difference between "compile" and "execute",
and what SAS does at different times at data step? |