Date: Mon, 1 Oct 2007 16:39:40 -0500
Reply-To: Mary <email@example.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Determining if Data Set is empty, and if so,
adding an observation?
Content-Type: text/plain; charset="iso-8859-1"
I'm doing this code out of proc frequencies:
ods output crosstabfreqs=crosstabfreqs_set chisq=chisq_set;
proc freq data=in_set;
tables disease_flag * &variable_macro /chisq nocol norow nopercent;
where disease_flag='0' and &variable_macro='0';
keep table frequency;
proc print data=control_0;
What I'd like to be able to do is to generate a record if the resulting data set has no records- in which I give that a frequency of 0, so that I can produce a table with all the frequencies, including those that don't appear in this run. For instance, the possible values are 0,1,2,3, but not all these frequencies occur on each variable (I'm doing thousands of variables, so will merge after this to get my final report).
I know I could do a
Proc SQL select count(*) from control_o into :count to get a count macro variable, but how could I use such as count macro variable to append a row to my data set if my count is 0?
Research Assistant III
Dept. of Ophthalmology
Univ. of Iowa Hospitals and Clinics