LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 2 Sep 2011 18:26:08 +0000
Reply-To:   "DUELL, BOB" <bd9439@ATT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "DUELL, BOB" <bd9439@ATT.COM>
Subject:   Re: Octiles
Comments:   To: Rick Wicklin <Rick.Wicklin@SAS.COM>
In-Reply-To:   <201109021811.p82FXVGG024049@waikiki.cc.uga.edu>
Content-Type:   text/plain; charset="us-ascii"

Good example, but why not use the RANKS statement and avoid the extra data step (merging into b)?

proc rank data=a out=quantiles groups=8; ranks qntl; var x; run;

Just askin'!

Bob

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Rick Wicklin Sent: Friday, September 02, 2011 11:12 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Octiles

Exactly right. (In general, the "octals" are called "quantiles".) Use the GROUPS=8 option, then sort by the quantiles and do a BY group analysis with PROC MEANS. The "gotcha" is you have to rename the quantiles:

data a; do i=1 to 100; x=rand("uniform");output; end; run; proc rank data=a out=quantiles groups=8; var x; run; data b; merge a quantiles(rename=(x=qntl)); label qntl = "Quantile"; run; proc print data=b;run; proc sort data=b; by qntl; run; proc means data=b N Min Median Max; by qntl; var x; run;

Rick Wicklin SAS/IML blog http://blogs.sas.com/content/iml


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