FW: syntax

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: syntax

Helga Walz
Thank you for your assistance ahead of time.

Could you please assist me with syntax, how to collapse the following because of small numbers:

length of living:   less than 6 months
                       1 to 5 years
                       6 to 10 years
                       More than 10 years
       into 2 categories  (<6 up to 5 years, 6 to >10 years))

religion:           Baptist
                      Protestant
                      Catholic
                      Muslim
                      Other
                     But not Jewish (because n is only 2)
  into 3 categories (Baptist, Protestant and Catholic, Muslim and Other



marital status: single/never married
                      divorced/separated                        into 2 categories
                      widowed
                      but not married  (because n=2 only)
   into 2 categories  (single/never married and divorced/separated, widowed)

ethnicity:    Caucasian/white
                 African American/Black
                 but not American Indian (n=1)
     into 2 categories (Caucasian/white, African American)

Age:   51 to 64
          65 to 70
          71 to 84
         85 to 90
  into 2 categories (51 to 64 and 65 to 70, 71 to 84)  but not 85 to 90

Thank you so much,

Helga

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: syntax

Melissa Ives
Look at the RECODE command..

RECODE

For numeric variables:

RECODE varlist (value list=value)...(value list=value) [INTO varlist]
       [/varlist...]
Input keywords:

LO, LOWEST, HI, HIGHEST, THRU, MISSING, SYSMIS, ELSE

Output keywords:

COPY, SYSMIS

For string variables:

RECODE varlist [('string',['string'...]='string')][INTO varlist]
       [/varlist...]

Input keywords:

CONVERT, ELSE

Output keyword:

COPY

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Helga Walz
Sent: Thursday, April 24, 2008 9:05 PM
To: [hidden email]
Subject: [SPSSX-L] FW: syntax

Thank you for your assistance ahead of time.

Could you please assist me with syntax, how to collapse the following because of small numbers:

length of living:   less than 6 months
                       1 to 5 years
                       6 to 10 years
                       More than 10 years
       into 2 categories  (<6 up to 5 years, 6 to >10 years))

religion:           Baptist
                      Protestant
                      Catholic
                      Muslim
                      Other
                     But not Jewish (because n is only 2)
  into 3 categories (Baptist, Protestant and Catholic, Muslim and Other



marital status: single/never married
                      divorced/separated                        into 2 categories
                      widowed
                      but not married  (because n=2 only)
   into 2 categories  (single/never married and divorced/separated, widowed)

ethnicity:    Caucasian/white
                 African American/Black
                 but not American Indian (n=1)
     into 2 categories (Caucasian/white, African American)

Age:   51 to 64
          65 to 70
          71 to 84
         85 to 90
  into 2 categories (51 to 64 and 65 to 70, 71 to 84)  but not 85 to 90

Thank you so much,

Helga

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: FW: syntax

Clive Downs
In reply to this post by Helga Walz
Hi Helga

You can do it this way:

1. If your variables (religion, marital status, ethnicity) are string
variables first use automatic recode on the 'transform' menu to convert
them to numeric variables. (this will be useful anyway in case you later
want to use inferential tests).
e.g. you can recode the variable 'religion' to one called 'relcode'
[NB SPSS will preserve the string values as value labels]

2. Having got them all in numeric form  choose transform > recode into
different variables :

- select the variable to recode e.g. if in step (1) you recoded
variable 'religion' to 'relcode', select 'relcode'
- call the output variable 'aggrelcode' (aggregated religion code)
- specify the mapping from relcode values to aggrelcode values -
- e.g. if your autorecode produced protestant as 2 and catholic as 3,
  you specify you want 'old values' as 1 through 2 and for example 'new
value' as 1

- and so on for all the religion values.

3. you can then give a label to each of the aggregated variable values, eg
if you collapsed the original 'protestant' and 'catholic' into one, you can
give the new value the label 'protestant and catholic'. You can do this by
choosing 'Define Variable properties', selecting the variable, and using
the label field in the dialog box corresponding to the relevant value to
enter the label you want.

4. I suggest you paste into syntax all the above commands, then it is
easier to edit any  labels or check correct for any  errors.

5. for those values (eg 'married') you don't want to collapse, you can
simply aggregate that value to a new value that has the same meaning - then
you keep it all tidy.

HTH,

Regards

Clive.

=====================
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