LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 1 Oct 2007 16:39:40 -0500
Reply-To:     Mary <mlhoward@avalon.net>
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"

Hi, there,

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;

title &variable_macro;

run;

data control_0;

set crosstabfreqs_set;

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?

Mary Howard

Research Assistant III

Dept. of Ophthalmology

Univ. of Iowa Hospitals and Clinics

-Mary


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