How do I combine variables in SPSS to create a new variable?

I want to create 6 groups in SPSS, originating from 2 groups but I don't know how to do this. I have one variable A which is binary (0.1-1 millimetre or >1 millimetre) and another variable B which has 3 possible values (3 treatment strategies for cancer: wait-and-see, polypectomy or surgery). I want to create a third variable out of these 2 with the possible outcomes: 0.1-1 mm + wait-and-see, 0.1-1 mm + polypectomy, 0.1-1 mm + surgery, >1 mm + wait-and-see, >1 mm + polypectomy, and >1 mm + surgery. Is it possible to do this in SPSS and if so, how can I do this?


TS Contributor
If the data file is short (small number of cases), then you could sort the data by variable A and variable B,
and then do it by hand (i.e. give each case one out of 6 different code numbers, for the 6 combinations).

Otherwise, what you can do depends on whether your variables are numeric or alphanumeric,
and if numeric, how they are coded.

With kind regards

Dear Karabiner,

Thank you for your response! It is a very large number of cases, so sorting by hand isn't an option. My variables are numeric (as in variable A can be 0 or 1 and variable B can be 0, 1 or 2).


TS Contributor
COMPUTE newvar=variableA*10 + variable B.

0 "0.1-1 mm + wait-and-see"
1 "0.1-1 mm + polypectomy"
2 "0.1-1 mm + surgery"
10 ">1 mm + wait-and-see"
11 ">1 mm + polypectomy"
12 ">1 mm +surgery" .