The Old and New Values dialog box allows you to specify new values for your existing input variable. This is easy to accomplish. This is quite obvious with , but also for but with different consequences: if the target variable already exists SPSS will warn you , only the cases matching the specifications will be changed overwritten , all others will be left untouched.
If your Recode creates a new variable, no properties will be defined except the variable label if you indicated it with the target variable name. Assume a simple example of a sex of respondent variable coded 1 for male and 2 for female with appropriate labels. Now recode 1 into 2 and 2 into 1 reversing the codes So please be careful to modify the variable properties immediately Just make sure that the number of input variables matches the number of output variables.
In a similar vein, HI can be used for the highest value. The old and new value pairs are read from left to right and an old value that's already been addressed will be ignored if it's addressed again.
This is also the reason that there's no point in specifying any old values after the ELSE keyword. This feature is sometimes used when discretizing continuous variables: you can use LO the lowest value that hasn't been previously addressed as the lower boundary for each category. The syntax below looks a bit awkward but is not unusual. As demonstrated, a descriptives by category table is a nice way to inspect these results.
Finally, note that RANK offers an alternative for discretizing variables. A disadvantage of recoding into new variables is they don't have any dictionary information by default. The tool also checks whether input variables are string variables.
If so, it automatically declares the new string variables with the correct lengths that are needed for recoding into. After cloning, we can safely recode into the same variables, leaving the variable order intact and minimizing the need for dictionary modifications after recoding. In case of doubt we can always check the recoded variable against its clone and if necessary delete it and start over from a new clone.
In some cases you may want to recode a string variable into a numeric one. This holds especially when you want to do calculations on ordinal variables under the Assumption of Equal Intervals. This would change all occurrences of value 4 to value 3. However, all other values would be treated as system missing. Here's the better way:. This changes all occurrences of value 4 to value 3, and all other values are copied to the new variable.
You can also use it with explicit values, as in the following example:. So don't forget to label the new variable. Missing values can be addressed via the keywords "sysmis" or "missing".
Assume that in addition to the values 1 thru 4, there are also values 8 and 9 which are defined as missing values.
0コメント