## Proc Rank Means and Differences for Quintiles

Occasional Contributor
Posts: 18

# Proc Rank Means and Differences for Quintiles

[ Edited ]

I have a dataset which I need to get quintiles for answers on a survey item (4 responses) stratified by site (N=33). I assume I'm missing a few proc steps. Is it possible to get the rank, the mean and the difference in mean? How do I get the rank of the site overall if there are multiple respondents within the site?

I have done the following code but not sure how to go any further. Thanks in advance.

PROC RANK DATA=answers GROUPS=5 TIES=MEAN OUT=answers_rank descending;
VAR Q6;
RANKS rank_Q6;
RUN;

proc means data=answers_rank noprint;
class site;
var rank_Q6 ;
output out=report
n=n
min(rank_Q6)=score_min max(rank_Q6)=score_max
mean(rank_Q6)=q6_mean;
run;

This is the data ouput I have:

 ID Site Q6 rank_Q6 1696 437 3 1 2343 437 2 1 5693 437 4 3 2412 520 2 2 28 539 3 1 1238 539 1 1 2272 539 3 1 5461 539 3 3 5466 539 4 4 113 544 3 4 1616 544 2 0

 site _type_ _freq_ n score_min score_max q6_mean . 0 169 167 0 4 1.994012 437 1 3 3 1 3 1.666667 520 1 1 1 2 2 2 539 1 5 5 1 4 2 544 1 5 5 0 4 1.8
Posts: 2,125

## Re: Proc Rank Means and Differences for Quintiles

You probably want to assign the quintiles combining all sites.  However, with a scale that is just scored 0-4, it is hard to get useful quintiles.

Differences in rank?  Between what?  People use that in a pre-post design and then you can have a table of the ranks and summarize changes with Cohen's Kappa (extended to multiple levels).

Occasional Contributor
Posts: 18

## Re: Proc Rank Means and Differences for Quintiles

Thanks, I meant to say 'differences in means'; I have updated that in the question.

Super User
Posts: 13,589

## Re: Proc Rank Means and Differences for Quintiles

I am having some difficulty determining what you want as the final output. Can you provide a small set, maybe reprsenting two sites with a few records and what the final desire output for that example data should look like. It may be that you want to take another pass into proc rank with the Report data set to rank the q6_mean.

Does your Q6 (or other varialbes of interest) only have 4 responses? Quintiles get a bit rough with that kind of data.

Occasional Contributor
Posts: 18

## Re: Proc Rank Means and Differences for Quintiles

I want to be able to rank these sites high to low at the site level based off of the average responses to the question. So separate sites into quintiles, get means and difference of mean by site.

Below is the first 10 rows of my data
which includes the respondent id, the site they are associated with, and the response to question 6.

ID Site Q6
1696 437 3
2343 437 2
5693 437 4
2412 520 2
28 539 3
1238 539 1
2272 539 3
5461 539 3
5466 539 4
113 544 3
1616 544 2

Super User
Posts: 13,589

## Re: Proc Rank Means and Differences for Quintiles

And the final result you would expect from this data?

Occasional Contributor
Posts: 18

## Re: Proc Rank Means and Differences for Quintiles

so the result would be something like below where the sites are grouped in their respective quintile, the number of sites in that quintile, rank, mean of each quintile, difference between quintiles.

Rank N_sites mean_rank diff_rank
1 26 2.5 -0.04
2 7 2 4
3 21 3 -0.25
4 16 4.88 0
5 38 1.7 0.67
Occasional Contributor
Posts: 18

## Re: Proc Rank Means and Differences for Quintiles

Yes, they all have 4 responses on a Likert type scale of 1-4.

Discussion stats
• 7 replies
• 727 views
• 0 likes
• 3 in conversation