Proc rank question

Reply
Occasional Contributor
Posts: 8

Proc rank question

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!

Respected Advisor
Posts: 4,920

Re: Proc rank question

Posted in reply to xkountrydude

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
Occasional Contributor
Posts: 8

Re: Proc rank question

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.

Respected Advisor
Posts: 4,920

Re: Proc rank question

Posted in reply to xkountrydude

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
Occasional Contributor
Posts: 8

Re: Proc rank question

Posted in reply to xkountrydude

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?

Respected Advisor
Posts: 4,920

Re: Proc rank question

Posted in reply to xkountrydude

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
Ask a Question
Discussion stats
  • 5 replies
  • 295 views
  • 0 likes
  • 2 in conversation