How to detect how many observations in a dataset (or if it is empty), in SAS?

It’s easy with PROC SQL. Do a count and put the results in a macro variable.

proc sql noprint;
 select count(*) into :observations from library.dataset;
quit;

Leave a Comment