BookmarkSubscribeRSS Feed
xkountrydude
Calcite | Level 5

Hi everyone,

I have a question regarding proc rank. I am working with a set of data and trying to create three quartiles or tertiles. However, the three groups that result do not have the same size or relatively similar sizes. Like my first tertile has 1229, second has 246, and three has 737 for a total of 2210. Can anyone explain to me why that is? I obviously was expecting the three groups to have roughly the same number of people. Is it because of the default settings? Thanks!

5 REPLIES 5
PGStats
Opal | Level 21

This is likely caused by the presence of lots of tied values in the variable you are ranking by. Unfortunately, none of the TIES= options in proc rank can really solve this problem. How you want to assign tied values to groups will determine what other solutions are available.

PG

PG
xkountrydude
Calcite | Level 5

Yeah, I can be more specific with that, I'm looking at amount of ethanol consumed per week and 1229 of the 2210 subjects have a value of 0, meaning they don't drink. Is there any reason you could give me as to why exactly all of the 1229 subjects went into the first tertile and no one else? Thank you so much for the help so far. I appreciate it.

PGStats
Opal | Level 21

For GROUPS=3, you would expect ranked observations 1 to 737 to end up in group 0, observations 738 to 1473 to be assigned to group 1 and the rest to group 2. With TIES=MEAN (the default), all your 1229 subjects with value=0 end up with mean rank 615 which belongs to group 0. With TIES=LOW they would have low rank=1 and be assigned to group 0 and with TIES=HIGH they would have high rank =1229 and thus end up in group 1. None of that would solve your problem.

The problem boils down to : How exactly do you want the non drinking subjects to be assigned to groups 0 and 1?

PG

PG
xkountrydude
Calcite | Level 5

Thank you very much for your help! I've another question that I keep coming across that maybe you can help me with. I'm trying to create a dichotomous exposure variable (call it alcoholic). If you have a value greater than 0, alcoholic = 1 and for everyone else alcoholic = 0. I'm trying to create 2x2 tables to look at associations but for some reason I get the outcome variable to have its values of 1 and 0 in that order but for the exposure alcoholic sas keeps giving me 0,1. Basically I want in the upper left hand corner those who are positive for both exposure and outcome. Do you know what you have to do in sas to make that work?

PGStats
Opal | Level 21

This is a new question, unrelated to "Proc rank question". You should start a new discussion with this question and if possible give an example of SAS code that displays the problem. That always attracts more answers.

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 654 views
  • 0 likes
  • 2 in conversation