BookmarkSubscribeRSS Feed
robertrao
Quartz | Level 8

Hi all,

i have 3 variables.

Los index is length  of stay

Hospital     Los Index        Mortality Index

A                 1.12                   1.28

B                 0.14                   0.94

For Hundreds of records like this...

I want to calculate percentiles      10,20 ,25, 30,40,50,60,75,80,90, and 100 th  for this data in SAS

And the ranks of the hospitals

Could somebody help me please..........

Thanks a lot

8 REPLIES 8
Doc_Duke
Rhodochrosite | Level 12

PROC UNIVARIATE and PROC SUMMARY will both get the percentiles for these.  PROC RANK will do the ranks.

robertrao
Quartz | Level 8

Hi Doc,

I first use proc univariate on the Los index variable.I will output the percentiles to another dataset,

To the output dataset when i use rank on the same variable i get rankalso in my final dataset.is that  right?????

Thanks a lot

Doc_Duke
Rhodochrosite | Level 12

no.  run PROC RANK directly against the raw data.

robertrao
Quartz | Level 8

SO DO U WANT ME TO RUN THIS CODE AND IT WILL GIVE PERCENTILES AS WELL AS RANKS FOR BOTH OF THESE VARIABLES????????

proc rank data=DSETNAME groups=100 out=ranked_a;

     var LOS_INDEX MORTALITY_INDEX;

     ranks rank_y;

     run;

Thanks

Doc_Duke
Rhodochrosite | Level 12

That will provide "percentile ranks"; it will not provide ranks as they are normally thought of (sequential number from 1 to <samples size>).

robertrao
Quartz | Level 8

Because i wanted 10,20 ,25, 30,40,50,60,75,80,90, and 100 th percentiles

as well as the ranks of each

Doc_Duke
Rhodochrosite | Level 12

I understand that.  PROC RANKS, as you wrote it, will not provide the ranks, it will provide 'percentile ranks' and they are a bit different.  In order to get both the specified percentiles and the ranks, you need to run two procedures.

robertrao
Quartz | Level 8

Great........

Thank you so very much Doc. I appreciate your time on this. Do you also work tomorow?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2257 views
  • 0 likes
  • 2 in conversation