Reverse Variable Value Order
revrs [varlist] [, replace]
Description
revrs reverses the value order of the specified variables and maintains the appropriate value labels. Without the replace option specified, the command will create a new variable called rev`origvar'. This command is especially useful for keeping variables with categorical response options all ordered in the same manner (e.g., "Most Important" always is highest value).
WARNING: This command only applies to the order of the values of the variable NOT the values themselves. The new reversed version of the variable will always start at 1.
Options
replace replaces the original variable with the reversed version. If invoked, it is applied to all variables in varlist.
+-----------+ ------+ Examples +------------------------------------------------------------ > ----------
. revrs foreign
. tab1 foreign revforeign
-> tabulation of foreign
Car type | Freq. Percent Cum. ------------+----------------------------------- Domestic | 52 70.27 70.27 Foreign | 22 29.73 100.00 ------------+----------------------------------- Total | 74 100.00
-> tabulation of revforeign
Car type | Freq. Percent Cum. ------------+----------------------------------- Foreign | 22 29.73 29.73 Domestic | 52 70.27 100.00 ------------+----------------------------------- Total | 74 100.00
Author Kyle C. Longest, University of North Carolina - Chapel Hill email: klongest@email.unc.edu