Sample 24769: Assign DATA step information to a macro variable using CALL SYMPUT
Count the number of observations in a SAS data set and
put that number into a macro variable.
Note:
The OPEN and ATTRN funtions can also be used to
determine the number of observations in a SAS data set. See
Sample 24671.
/* "IF 0" is always false, so the SET never executes. However, the */
/* data set DSONE is opened at compile time, so we gain access */
/* to the number of observations in the data set, NOBS, from the */
/* descriptor portion of the data set. */
data dsone;
do i=1 to 5;
output;
end;
run;
data _null_;
if 0 then set dsone nobs=count;
call symput('count',left(put(count,8.)));
stop;
run;
%put &count;
Count the number of observations in a SAS data set and put that number into a macro variable.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> CALL routines
|
| Date Modified: | 2005-12-08 11:34:32 |
| Date Created: | 2004-09-30 14:09:12 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |