Date: Tue, 20 Jul 2004 10:45:11 -0400
Reply-To: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Subject: Re: Help: display order
On Fri, 16 Jul 2004 13:24:33 -0700, Cathy <cathydwu@YAHOO.COM> wrote:
>Hi all:
>
>Thank you in advance for your help.
>
>I have serveral variables, and I use format to group them to get freq
>and save the freq/percent into a file.
>
>Later, I want to create report/plot and I have the problem to properly
>display them. I wish the display order is the same as defined in the
>format. I have tried to use 'order = formatted' or 'order=data' in
>'proc tabulate'. Sometimes it displays in order, sometimes not.
>
>The following is the simplified program.
>
>==============================
>data a;
>input score group $;
>datalines;
>0 a
>35 b
>23 a
>15 c
>. d
>12 a
>78 c
>46 a
>23 b
>;
>run;
>proc format;
>value score . = 'missing'
> low - 0 = '<= 0'
> 0 <- 10 = '0-10'
> 10 <- 20 = '10-20'
> 20 <- 30 = '20-30'
> 30 <- 40 = '30-40'
> 40 - high = '> 40';
>run;
>ods output OneWayFreqs(match_all=datasetnames)=freqout;
>ods listing close;
>
>proc freq data = a;
>table score/ missing;
>format score score.;
>run;
>
>ods listing;
>ods output close;
>
>data b;
>set freqout;
>length range $20;
>range = left(F_score);
>run;
>
>proc tabulate data = b missing order=formatted;
>class range;
>var percent;
>table range, percent ;
>run;
>
>===========
>Thanks.
>
>Cathy
You may find a reading of ts-407 (Ordering Data Values: Procedure Defaults
and Options) useful.
http://support.sas.com/techsup/technote/ts407.html
Venky
|