|Date: ||Fri, 18 Jul 2008 13:38:24 -0700|
|Reply-To: ||Adriano Rodrigues <adriano@GPP.COM.BR>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Adriano Rodrigues <adriano@GPP.COM.BR>|
|Subject: ||RES: proc freq order option for almost all values?|
|Content-Type: ||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.
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
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>
>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.
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?
value cars 1='Lamborghini' 2='Ferrari'
3='Audi SpB ' 4='Not sure' ;
/* test data */
cars=1; freq=55.5; output;
cars=2; freq=32.5; output;
cars=3; freq= 5.0; output;
cars=4; freq= 7.0; output;
/* 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. */
length not_sure $1;
not_sure = ifc(cars=4,"*", "");
proc freq order=freq data=carsview;
tables not_sure * cars/ missing list nocum;
format cars cars.;
/* 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