ID HVAR WVAR
1 5 6
2 4 7
3 5 5
4 4 6
...
And, we'd like to stack the husband and wife column into a single column
and add a sex variable:
ID SEX VAR
1 1 5
1 2 6
2 1 4
2 2 7
3 1 5
3 2 5
4 1 4
4 2 6
...
Any ideas on how this can be done?
Thanks in advance,
Dave Atkins
hope that helps.
Manolo
> Hello, I have a problem which I suspect others have had as well. Namely,
> is it possible within SPSS to stack and unstack data columns? We do
> marital research and sometimes we have husband and wife data in separate
> columns:
ID HUSBAND-score WIFE-score
becomes two records per family, with
ID Gender=1 Score
ID Gender=2 Score
after you use the "LOOP" instruction, and Xsave. You might also use
Vector Who(2).
Then, while LOOPing on Gender=1,2
you +compute Score=Who(Gender),
and write out, +Xsave ... ID, Gender, Score.
Look for a detailed example on the SPSS website.
--
Rich Ulrich
http://www.pitt.edu/~wpilib/index.html
string family(a8).
compute family = hvar.
sort cases by id.
save outfile= his.sav
/keep id hvar family
/compressed.
compute family = ' '.
compute family = wvar.
sort cases by id.
save outfile= her.sav
/keep id wvar family
/compressed.
add files
file= his.sav
/file= her.sav.
sort cases by id.