Date: Tue, 13 May 2003 09:32:48 -0400
Reply-To: SPSSX-L@LISTSERV.UGA.EDU
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Bob Walker <spss@surveys-forecasts.com>
Subject: Re: New Var from 3 vars
In-Reply-To: <06F4FFE29EF3454D86A2E43487DC287BE267D6@hqemail1.spss.com>
Content-type: text/plain; charset=us-ascii
Jon:
Yes, a good upgrade, since ANY assigns a zero to non-matching values,
including system missing, so no need for a RECODE statement. Peter
should choose a variable name (8 chars or less) for use in syntax,
though. So:
NEWVAR = ANY(16, VAR1 TO VAR3).
Bob
Surveys & Forecasts, LLC
2323 North Street
Fairfield, CT 06824-1738 USA
T +1.203.255.0505
F +1.203.255.0517
www.surveys-forecasts.com
|-----Original Message-----
|From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
Of
|Peck, Jon
|Sent: Tuesday, May 13, 2003 8:49 AM
|To: SPSSX-L@LISTSERV.UGA.EDU
|Subject: Re: New Var from 3 vars
|
|If you don't know about the "any" function, here's a tip for your bag
of
|tricks:
|
|compute SweetSixteen = any(16, var1, var2, var3).
|
|Peter,
|
|Unless I'm misunderstanding you, this should suffice...
|
|IF (VAR1 = 16 OR VAR2 = 16 OR VAR3 = 16) NEWVAR = 1.
|RECODE NEWVAR (1=1) (ELSE=0).
|
|Bob Walker
|Surveys & Forecasts, LLC
|www.surveys-forecasts.com
|
|
||-----Original Message-----
||From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf
|Of
||Peter Fagan
||Sent: Monday, May 12, 2003 5:50 PM
||To: SPSSX-L@LISTSERV.UGA.EDU
||Subject: New Var from 3 vars
||
||The solution offered by Jim Marks to James Moffitt recently should
have
||enabled me to solve this, but I have not be able. So....
||
||If any of three existing vars has the value of 16, I would like to
||create a new var that would have value of "1" if 16 was present in
any
||one of the three, or "0" if absent.
||
||Thanks in advance.
||
||Peter
||
||Peter J. Fagan, Ph.D.
|