LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 7 Jul 2008 15:23:30 -0500
Reply-To:     "data _null_," <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_," <datanull@GMAIL.COM>
Subject:      Re: SET with OBS=0
Comments: To: Mary <mlhoward@avalon.net>
In-Reply-To:  <09e701c8e067$f1df84b0$832fa8c0@HP82083701405>
Content-Type: text/plain; charset=ISO-8859-1

On 7/7/08, Mary <mlhoward@avalon.net> wrote: > > For my case, I want to set the specific data set that I'm specifying in ODS > to have no observations before running the procedure, then I can ask whether > it still has no observations after running the procedure.

But that's not what you're doing. You are counting the observations. Not checking that it is still zero. As you said you can use the dictionary tables to determine if a data set has zero observations or not.

data noObsOrVars; stop; run; proc sql; select memname,nobs from dictionary.tables where libname eq 'WORK' and memname eq 'NOOBSORVARS'; quit; run;

However using this method requires macro variables and macros which may not be needed. You can also code a data step to cause some actions when there are no observations in a data set. Plus you don't need to count anything.

211 data crossTabFreqs; 212 stop; 213 run;

NOTE: The data set WORK.CROSSTABFREQS has 0 observations and 0 variables.

214 ods listing close; 215 ods output crossTabFreqs=crossTabFreqs; 216 proc freq data=sashelp.class; 217 tables sex*age / list; 218 run;

WARNING: Output 'crossTabFreqs' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. NOTE: There were 19 observations read from the data set SASHELP.CLASS.

219 ods listing; 220 data crossTabFreqs; 221 if _n_ eq 1 and eof then do; 222 put 'NOTE: NO observations'; 223 call execute('*endsas; *perhaps;'); 224 end; 225 set crossTabFreqs end=eof; 226 run;

NOTE: NO observations NOTE: There were 0 observations read from the data set WORK.CROSSTABFREQS. NOTE: The data set WORK.CROSSTABFREQS has 0 observations and 0 variables.

NOTE: CALL EXECUTE generated line. 1 + *endsas; *perhaps;


Back to: Top of message | Previous page | Main SAS-L page