0
votes

I have two variables, A and B, that both use a 5-digit code starting with 50. So variable A might be 50123 to designate orange and B might be 50123 to designate apple. The codes were originally constructed to be concatenated together to create a single hierarchy code. I now need to consider them independently and must be able to distinguish between a code for variable A and variable B.

Bottom line is I want to recode variable A items from 50123 to 60123 and variable B items from 50123 to 70123. What's the best way to do this in SPSS without having to manually enter items either in syntax or the recode dialog box?

Thanks

1

1 Answers

0
votes

If variables A and B are numbers, you could try

compute A=A+10000.
compute B=B+20000.

If they are strings, this should work:

compute A=concat("6", char.substr(A,2,5)).
compute B=concat("7", char.substr(B,2,5)).