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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.