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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.