Date: Wed, 13 May 2009 10:07:23 -0700
Reply-To: jingtailan@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jingtailan@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: what is wrong with my code for %length of a data set
Content-Type: text/plain; charset=ISO-8859-1
On May 13, 11:46 am, pcho...@DDS.CA.GOV ("Choate, Paul@DDS") wrote:
> Interesting - an OUTPUT statement *before* a SET statement referring to
> an empty dataset will produce a record of missing values from an empty
> dataset.
>
> data nada;
> set sashelp.class;
> if "F"<sex<"M" then output;
> run;
>
> data zerolines;
> set nada;
> run;
>
> data zerolines2;
> set nada;
> output;
> run;
>
> data oneline;
> output;
> set nada;
> run;
>
> Paul Choate
> DDS Data Extraction
> (916) 654-2160
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
> jingtai...@gmail.com
> Sent: Wednesday, May 13, 2009 8:04 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: what is wrong with my code for %length of a data set
>
> dear all:
>
> i am trying to output ONE record from a 0 obseration data set. but the
> macro is not working, can you please help ? thks.
>
> Jingtailan
> ============================
>
> data three;
> set postz;
> by subjid labcat ltstcod d_vwin _trt;
> if last.subjid;
> d_vwin=9999;
> run;
>
> %macro try;
>
> data post1;
> set one
> two
> %if %length(three) %then %do;
> flp;
> %end;
> %else %do;
> output;
> vwin=9999;
> output;
> %end;
> run;
> %mend;
>
> %try ;- Hide quoted text -
>
> - Show quoted text -
=====
Paul:
it worked, the question is are there any automatic way to find out if
THREE has oberservation or not, if yes , then append to ONE, TWO.if
not , then inTHREE, create d_vwin=9999 .
GOAL: need to use d_vwin for proc means count and proc report output
eventhough there is no observation in THEREE.
eg.
d_vwin n/(pct)
1 10(.10)
2 20(.39)
9999 0(0.0)
thanks.
Jingtailan
|