Your SAS programs, embedded in web apps and elsewhere

Is Dataset Empty

Accepted Solution Solved
Reply
Super Contributor
Posts: 497
Accepted Solution

Is Dataset Empty

Is there a simple way to check if a SAS dataset is empty in 9.2?

I could do a proc sql with count(*) but I was hoping for something with less lines.


Accepted Solutions
Solution
‎08-28-2015 03:10 PM
Valued Guide
Posts: 860

Re: Is Dataset Empty

Posted in reply to DavidPhillips2

Either one will give you the same thing, could save time if the dataset turns out to be huge, you wouldn't have to wait for the count():

proc datasets lib=work nolist;contents data=have;quit;run;

proc contents data=work.have;

View solution in original post


All Replies
Solution
‎08-28-2015 03:10 PM
Valued Guide
Posts: 860

Re: Is Dataset Empty

Posted in reply to DavidPhillips2

Either one will give you the same thing, could save time if the dataset turns out to be huge, you wouldn't have to wait for the count():

proc datasets lib=work nolist;contents data=have;quit;run;

proc contents data=work.have;

PROC Star
Posts: 1,322

Re: Is Dataset Empty

Posted in reply to DavidPhillips2

I like these macros for counting obs and checking if a dataset is empty.

http://www2.sas.com/proceedings/sugi26/p095-26.pdf

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 386 views
  • 1 like
  • 3 in conversation