Good question - or is it an order ("correct...")? Anyway, a great tutorial with well written examples is http://www.spss-tutorials.com/spss-recode-command/
The main problem is in the spec of your new variables: when defining new variables
with TO, you can only vary the last subscript. That is,
is not valid, but
is. I further suggest you take a look at this excellent explanation of the TO keyword: http://www.spss-tutorials.com/spss-keywords/#to
Second, use TO for ranges of variables, THRU for ranges of values.
Third, perhaps put the entire command on one or two lines, it'll keep your syntax more compact.
Fourth, are you sure there's only integer values in these variables? Note that 9.5 will not be RECODEd into anything.
Fifth, you consider using
Code: Select all
compute newvar = trunc(oldvar/ 10) + 1.
in a DO REPEAT block instead of RECODE here.