Coding Ordinal Data
This week we got a question from Mark Mortensen regarding Coding Ordinal Data.
“What is the best way to set up a variable and code ordinal data when it is generated by a question such as “Rank the following three items using 1 as the most use, 2 the next most use, and three, the least use?”
For this query we can consider the following example. In the following data there is three different 4 wheelers brands. The respondent gives the opinion about usage on their brand like most often, second most often and least often. It is captured brand wise. Using this syntax easily we can find out which brand is most often, second most often and least often. This recoding we can do vise-versa based on data capturing.
Â
Data:
Audi     BMW   Benz
——- Â ——- ——–
1Â Â Â Â Â Â Â Â Â 2Â Â Â Â Â Â Â Â Â 3
2Â Â Â Â Â Â Â Â Â 3Â Â Â Â Â Â Â Â Â 1
3Â Â Â Â Â Â Â Â Â 1Â Â Â Â Â Â Â Â Â 2
1- Most often   Â
2-Second most often
3-least often
*** The following syntax will recode the respondent’s opinion into new variable rank1, 2 and 3.
IF (Audi =1) Rank1 = 1.
IF (BMW =1) Rank1 = 2.
IF (Benz =1) Rank1 = 3.
Execute.
IF (Audi =2) Rank2 = 1.
IF (BMW =2) Rank2 = 2.
IF (Benz =2) Rank2 = 3.
Execute.
IF (Audi =3) Rank3 = 1.
IF (BMW =3) Rank3 = 2.
IF (Benz =3) Rank3 = 3.
Execute.
Variable label
Rank1 ‘Most Often’
Rank2 ‘Second Most Often’
Rank3 ‘Least Often’.
Value label Rank1 Rank2 Rank3
1 “Audi”
2 “BMW”
3 “Benz”.
After using this syntax we will get the new variables like in this way,
Rank1 Â Rank2Â Â Rank3
——-Â Â —— Â ——–
Audi     BMW   Benz
Benz    Audi     BMW
BMW    Benz    Audi
Thanks,
Lawrence.
2 comments November 3rd, 2006