Date: Wed, 2 Jul 2008 08:50:29 -0700
Reply-To: Dennis Deck <DDeck@rmccorp.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Dennis Deck <DDeck@rmccorp.com>
Subject: Re: Loops
Content-Type: text/plain; charset="us-ascii"
From your brief description the simplest way would be:
COMPUTE GenAge = Gender*10 + Age .
This creates a combined variable with values 11, 12, 21, 22.
(Note that your example suggests that age is categorical [1=1 to 14,
2=15 to 17].)
Only downside is that there are gaps in the values.
Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax: 503-223-8248
ddeck@rmccorp.com
-----Original Message-----
From: Khaleel Hussaini [mailto:khaleel.hussaini@gmail.com]
Sent: Tuesday, July 01, 2008 4:51 PM
Subject: Loops
Hi Listers!
I have a simple query that requires me to go through 22 statements
to create a new variable. Here is where I need help.
Age (11 categories) and Gender (2 categories). I want to have a new
variable called Gen_Age which combines information from these two
variables. Females
(1 to 14), Males (1 to 14), Females (15 to 17) Males (15 to 17) etc. Can
we use a vector and/or a loop function to create new variable with 22
categories? Mind you I don't want dummy variables. Best, SKH.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|