| Date: | Wed, 15 Jul 2009 10:20:01 -0400 |
| Reply-To: | Jonas Bilenas <jonas.bilenas@CHASE.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jonas Bilenas <jonas.bilenas@CHASE.COM> |
| Subject: | Re: PROC RANK |
|---|
The joys of PROC RANK. Don't get me wrong, I am a fan but you will get
different results on how you use PROC RANK. You can check out a
presentation I did non PROC RANK at PhilaSUG this past month which will
also be offered at NESUG this year (2009) in Vermont. Copy of the PhilaSUG
presentation will eventually hit the PhilaSUG website, but you can also
take a look at it on:
http://jonasbilenas.com/PROC-RANK_PhilaSUG_Spring2009.pdf
First things to look is to probably include a ROUND function on the
variable you wish to rank.
Next you may want to check out options on TIES even if you don't have
ties. Default is TIES=MEAN and other options include TIES=LOW, TIES=HIGH,
and TIES=DENSE (only in SAS 9.2). You may also want to play around with
DESCENDING option.
Also note that you don't need to run a PROC SORT as a pre-process of the
data.
Hope this helps,
Jonas V. Bilenas
FORMAT geek.
On Wed, 15 Jul 2009 03:52:29 -0700, xinrong <xleiuiuc@GMAIL.COM> wrote:
>use "proc sql" left join the origninal 506 records with the 504 "proc
>rank" output,
>then it is easy to find out which 2 records has been ignored.
>hope these can help you find out what goes wrong.
>
>
>On Jul 14, 4:37 pm, Shaheen <siqu...@gmail.com> wrote:
>> Hi,
>> I have a dataset with 506 record and I am using PROC Rank to Rank this
>> data into quintiles. I was expecting to see 101-101-101-101-102
>> observation or 102-101-101-101-101 but instead I get
>> 100-102-102-100-100. Ranking field has no missing value and no
>> duplicates. Is there a way to get the ranking I want?
>>
>> Regards,
>> Shaheen
>>
>> PROC SORT DATA=InvSys.Test1;
>> By Ranking_Field;
>> run;
>>
>> PROC RANK DATA=InvSys.Test OUT=InvSys.Test1 groups=5;
>> VAR Ranking_Field;
>> RANKS Rank;
>> run;
>>
>> PROC SQL;
>> CREATE TABLE InvSys.Test2
>> AS
>> (
>> SELECT Rank,Count(Rank)
>> FROM InvSys.Test1
>> Group By Rank
>> );
>> quit;
|