Date: Wed, 15 Oct 2008 09:28:40 -0400
Reply-To: Ed Heaton <EdHeaton@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ed Heaton <EdHeaton@WESTAT.COM>
Subject: Re: Check for empty dataset
In-Reply-To: <6102d140-e115-416f-92f2-21bb0065df6b@s9g2000prm.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Helen;
Precisely what are you trying to do? If you read an empty dataset and set Sex to missing, you still end up with an empty dataset?
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1650 Research Boulevard, TB-286, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-2085
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of helen
Sent: Tuesday, October 14, 2008 11:28 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Check for empty dataset
I have a couple dozen datasets generated by a sas procedure. Some of datasets have empty record. I would like to detect them for process.
I was trying use the following code to do it, but it did not work.
data t;
set sashelp.class;
if sex='D';
run;
data t1;
set sashelp.class;
run;
%macro count(inds=, outds=);
%if %sysfunc(exist(&inds))=0 %then %do; /*Note1*/
data &outds;
set &inds;
sex='';
run;
%end;
%else %do;
data &outds;
set &inds;
run;
%end;
%mend count;
%count(inds=t, outds=t_t);
%count(inds=t1, outds=t1_t);
*********************
It looks like that the code "%if %sysfunc(exist(&inds))=0 %then %do;" did not work. Thanks in advance.