a generic macro to Determine and return the number of physical observations in the specified dataset.!!!
%macro check(dsName = );
%let dsid = %sysfunc(open(&dsName, IS));
%if &DSID = 0 %then
%put %sysfunc(sysmsg());
%let nlobs = %sysfunc(attrn(&dsid,NLOBS));
%put No of Observation in dataset %trim(&dsName) : %trim(&nlobs);
%let rc = %sysfunc(close(&dsid));
%mend;
%check(dsName = );
Yes it works if you would have ran it you would have known
Rgds,
Abhi
can you paste what macro call u used and the log for the same
In ur macro call please could you pass the dataset name
%check(dsName= <<YOUR DATASET NAME HERE LIBRARY.DATASETNAME)>> );
In
%check(dsName=);
you specifically submitted an empty string to the macro, so no dataset could be found.
Supply a valid dataset name, and the macro will work.
Inform yourself about how parameters are passed to macros.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.