FW: [SPSSX-L] Loops

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: [SPSSX-L] Loops

Melissa Ives
I noticed I had sent this to Kahleel, but not to the list, so I thought I should send it on.
This is very similar to what Dennis Deck sent, but with a slight variation.

Try something like this:

This ends up with pseudocode where the first digit indicates gender (1=male, 2=female) and the 2nd is age group.

Recode age (1 thru 14=1)(15 thru 17=2)(18 thru...) into agegrp.
*** make sure gender is coded 1=male, 2=female for the same results as above) Compute GEN_AGE=(Gender*10)+agegrp.

Note that if your agegrp variable will need two digits, the you'd need to multiply gender by 100 instead of 10.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Khaleel Hussaini
Sent: Tuesday, July 01, 2008 6:51 PM
To: [hidden email]
Subject: [SPSSX-L] 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 [hidden email] (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

PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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