Proc Rank Means and Differences for Quintiles

Reply
Occasional Contributor
Posts: 6

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:

 

IDSiteQ6rank_Q6
169643731
234343721
569343743
241252022
2853931
123853911
227253931
546153933
546653944
11354434
161654420

 

site_type__freq_nscore_minscore_maxq6_mean
.0169167041.994012
437133131.666667
520111222
539155142
544155041.8
Trusted Advisor
Posts: 2,115

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: 6

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: 11,343

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: 6

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: 11,343

Re: Proc Rank Means and Differences for Quintiles

And the final result you would expect from this data?

Occasional Contributor
Posts: 6

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: 6

Re: Proc Rank Means and Differences for Quintiles

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

Ask a Question
Discussion stats
  • 7 replies
  • 489 views
  • 0 likes
  • 3 in conversation