%macro checkNobs(dsn); data _null_; if NObs=0 then do; call symput("ObsCount","0"); file print notitles; put "There are no observations in &dsn"; end; else call symput("ObsCount",put(NObs,best12.)); stop; set &dsn nobs=NObs; run; %if &ObsCount > 0 %then %do; proc print data=&dsn(obs=10); title1 "A few observations from &dsn"; run; %end; %mend checkNobs; %checkNobs(SASHELP.CLASS) *Valid data set; %checkNobs(SASHELP.DPLOG) *Empty data set;