7 -> 1, 6 -> 2, etc. is in Stata terms
8 - rank
if that is part of the question. A hand-waving argument
will convince you that this is true.
Subtracting 1/2 in the event of ties seems to follow
in your case from (1) inverting the scale and (2) adjusting
for cases in which two things are assigned the
same rank. But it is not quite right for ties of
three or more.
The more general adjustment if you need
to ensure that each respondent has the same total
weight in whatever you are doing is to assign to
tied ranks the average of the ranks that would have been
assigned otherwise. In Stata, this is simply done
by using -egen, rank()- on the "ranks". -egen, rank()-
has various options, but that is the default.
So you need to flip the scale and massage the ties,
and it doesn't matter which you do first.
I don't see that you need to use -if- (or with
a nod to my co-author David Kantor, -cond()-)
for any of this.
Suppose your variables are rank1-rank8.
foreach v of var rank1-rank8 {
tempvar work
gen `work' = 8 - `v'
egen new`v' = rank(`work')
label var new`v' "corrected rank from `v'"
drop `work'
}
Nick
[email protected]
Mike Stern
> I have a programming question:
>
> I have need to convert 8 variables from a social survey that
> respondents
> rated on a scale from 1 to 7 to implied rankings. The survey
> question asks
> respondents to rate 8 items relative to one issue with 1
> being much less
> important and 7 being much more important with 4 being just
> as important
> (conceptual middle point). Therefore, a ranking needs to be
> relative to the
> center point and because it now needs to be a ranking 7 needs
> to be recoded
> to 1, 6 needs to be recoded to 2 and so on.
>
> This would not be a particularly thorny issue except for the fact that
> respondents often rated two or more of the variables at the
> same level (e.g.
> two or three items given a 5). For such ratings, I am taking
> a 1/2 point
> off their ranking. I have a situation where if respondents
> rated two items
> 5 (after the recoding needed to convert a rating to ranking--much more
> important now equaling 1 instead of 7 and much less important
> now equaling 7
> instead of 1 and so on) the two items receive a score of 3.5.
>
> Does anyone know of ways that stata can convert ratings to
> rankings without
> a large number of "if then" statements for every possible
> combination of
> duplicate ratings?
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/