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.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* "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;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
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 |