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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.