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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.