Hi Alex. Judging from Andy's suggestion to use AUTORECODE with /GROUP, I think he understood your A and B variables to be strings. I, on the other hand, thought you meant they were numeric variables with A-F as value labels. Which is it? Please provide a small data set that shows what you have currently, and what you want it to look like after the new AB variable has been computed.
To get things started, here's my guess as to what you are trying to do. But it's just a guess.
NEW FILE.
DATASET CLOSE all.
* My guess as to the initial state.
DATA LIST /A 1 B 2.
BEGIN DATA
1.
2.
3.
.1
.2
.3
END DATA.
VALUE LABELS
A 1 "A" 2 "B" 3 "C" /
B 1 "D" 2 "E" 3 "F"
.
* My guess as to what you want to do.
IF NOT MISSING(A) AB = A.
IF NOT MISSING(B) AB = B+3.
FORMATS AB(F1).
VALUE LABELS AB
1 "A" 2 "B" 3 "C"
4 "D" 5 "E" 6 "F"
.
FREQUENCIES A B AB.
* I think you are asking how to automate this so
* that you don't have to explicitly apply the
* value labels to AB.
HTH.
Alex Huang wrote
Dear List,
I would like to do the following:
Variable A contains values 1=A, 2=B, 3=C, while Variable B contains 1=D, 2=E, 3=F, and are mutually exclusive. I would like to merge the variable, resulting Variable AB which contains 1=A, 2=B, 3=C, 4=D, 5=E, 6=F.
Is there a way that I can recode variable B from:
VALUE LABELS B
1 "D"
2 "E"
3 "F"/
to
VALUE LABELS B
4 "D"
5 "E"
6 "F"/
without knowing what D, E and F are, but just know I need them all added by 3?
Many Thanks,
Alex
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/"When all else fails, RTFM."
PLEASE NOTE THE FOLLOWING:
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (
https://listserv.uga.edu/).