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 13:26:24 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.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=ISO-8859-1

RANKS statement and CLASS will fix all that fiddling.

data a; do i=1 to 100; x=rand("uniform");output; end; run; proc rank data=a out=quantiles groups=8; var x; ranks qntl; run; proc print data=quantiles; run;

proc means data=quantiles N Min Median Max; class qntl; var x; run;

On Fri, Sep 2, 2011 at 1:11 PM, Rick Wicklin <Rick.Wicklin@sas.com> wrote: > 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