Re: Repeat case equals VAR
Posted by
Bruce Weaver on
Mar 29, 2013; 10:11pm
URL: http://spssx-discussion.165.s1.nabble.com/Repeat-case-equals-VAR-tp5719153p5719187.html
Ah, is
that what the OP meant? What if all 3 variables are the same?
DATA LIST Free / V1 V2 V3.
BEGIN DATA
1 1 2
3 2 3
3 2 2
3 3 3
END DATA.
STRING NEWVAR (A10).
DO IF SD.3(V1,V2,V3) EQ 0.
- Compute NEWVAR="V1,V2,V3".
ELSE IF (V1=V2).
- Compute NEWVAR="V1,V2".
ELSE IF (V2=V3).
- COMPUTE NEWVAR="V2,V3".
ELSE IF (V1=V3).
- COMPUTE NEWVAR = "V1,V3".
END IF .
LIST .
Ujjawal wrote
DATA LIST Free / V1 V2 V3.
BEGIN DATA
1 1 2
3 2 3
3 2 2
END DATA.
STRING NEWVAR (A10).
DO IF (V1=V2).
Compute NEWVAR="V1,V2".
ELSE IF (V2=V3).
COMPUTE NEWVAR="V2,V3".
ELSE IF (V1=V3).
COMPUTE NEWVAR = "V1,V3".
END IF .
LIST .
V1 V2 V3 NEWVAR
1.00 1.00 2.00 V1,V2
3.00 2.00 3.00 V1,V3
3.00 2.00 2.00 V2,V3
--
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/).