Date: Tue, 20 Apr 2004 08:33:15 +0200
Reply-To: Spousta Jan <JSpousta@CSAS.cz>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Spousta Jan <JSpousta@CSAS.cz>
Subject: Re: Combining Existing Variables to Create a New Variable
Content-Type: text/plain; charset="iso-8859-1"
Hi Glenys,
string newvar (A1).
compute newvar = qb.
if (qa = 'Y') newvar = 'Y'.
execute.
provided you have variables qa and qb as strings (syntax not tested, but I hope it will run). Execute command is not needed if you run another commants after that.
HTH
Jan
-----Original Message-----
From: Glenys Lafrance [mailto:g.lafrance@rogers.com]
Sent: Tuesday, April 20, 2004 7:23 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Combining Existing Variables to Create a New Variable
Hi. I am a graduate student working on a research project. If my questions are too elementary for your group, please redirect me to other more appropriate sources.
I want to create a new variable from 2 existing ones. If the response to Question A = Y, then New Variable = Y, otherwise use the response for Question B. Can I use the Recode or Compute functions do achieve this? If so, how? Or do I have to program it?
I can do it using Excel and copy the results into the SPSS data table but it seems inefficient.
Thanks,
Glenys Lafrance
|