Return to Snippet

Revision: 22957
at January 26, 2010 14:31 by sastechies

Initial Code
options nosource;
%macro RecsInDS(table,macvar);
   %global &macvar;
   %local handle rc;
   %let handle = %sysfunc(open(&table)); /* Open the table with open() function*/
   %if &handle %then  
          %let &macvar = %sysfunc(attrn(&handle, nlobs)); /* get the observation count into the macvar macro variable using the function attrn() with nlobs as the option*/
           %let rc = %sysfunc(close(&handle)); /* close the dataset with the close() function */
    %PUT RecsInDS &table: &&&macvar.    &macvar=&&&macvar.; /* write the Record count to the Log */
%mend RecsInDS;

/*Now Call the Macro...*/


Initial URL

Initial Description

Initial Title
SAS Macro to get the number of observations in a dataset...

Initial Tags

Initial Language