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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2275 views
  • 0 likes
  • 2 in conversation