Date: Fri, 18 Jul 2008 13:38:24 -0700 Adriano Rodrigues "SAS(r) Discussion" Adriano Rodrigues RES: proc freq order option for almost all values? To: Chang Chung <200807181610.m6IAlE9i021254@malibu.cc.uga.edu> text/plain; charset="us-ascii"

Thanks to Chang and data_null_

My 1st solution is like Chang posted, but failed when I tried to use for many questions, as some the % of notsure is > all others answers together. I wanted know about one solution using some option I maybe didn't know, thanks anyway to both.

-----Mensagem original----- De: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] Em nome de Chang Chung Enviada em: sexta-feira, 18 de julho de 2008 09:10 Para: SAS-L@LISTSERV.UGA.EDU Assunto: Re: proc freq order option for almost all values?

On Fri, 18 Jul 2008 11:31:06 -0700, Adriano Rodrigues <adriano@GPP.COM.BR> wrote: ... >Is there a way direct in proc freq? like one option "order all but >bestcar=4" : - ) I can do this in other ways...just looking one more smart >way, maybe some option I don't know how to use.

hi, Adriano, no such options. below is a hack following data _null_'s use of data step view. this works as long as the percentage of being not sure is less than 50. Can you see why? cheers, chang

proc format; value cars 1='Lamborghini' 2='Ferrari' 3='Audi SpB ' 4='Not sure' ; run;

/* test data */ data cars; cars=1; freq=55.5; output; cars=2; freq=32.5; output; cars=3; freq= 5.0; output; cars=4; freq= 7.0; output; run;

/* freq table ordered descending by weighted freq with the level 4 (not sure) at the bottom. this will work as long as the weighted freq of being not sure is less than that of sure. */ data carsview/view=carsview; set cars; length not_sure \$1; not_sure = ifc(cars=4,"*", ""); run; proc freq order=freq data=carsview; tables not_sure * cars/ missing list nocum; format cars cars.; weight freq; run; /* on lst The FREQ Procedure

not_sure cars Frequency Percent ------------------------------------------------ Lamborghini 55.5 55.50 Ferrari 32.5 32.50 Audi SpB 5 5.00 * Not sure 7 7.00

*/

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