Combining categorical variables

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

cheeseman
Posts: 2
Joined: Mon Sep 21, 2015 8:54 pm

Combining categorical variables

Postby cheeseman » Mon Sep 21, 2015 9:03 pm

Hi, first post

I have age variables that are categorised:

21-25
26-30
31-35
etc
etc

I want to combine the variables so that I have three bigger brackets eg

30 and under
31-55
55 and over

Any help would be very gladly appreciated!

Cheeseman :D
Erikyo
Posts: 28
Joined: Mon Mar 30, 2009 8:20 pm

Re: Combining categorical variables

Postby Erikyo » Wed Sep 23, 2015 1:30 pm

Hi,

If I understand correctly, let's say your original is AGE. Where ...

21-25 is code 1
26-30 is code 2
31-35 is code 3
and up to 6 codes

You have to do a "Recode into different variable" creating AGE2 (that way, you keep your original variable intact.

And it goes like this :

RECODE AGE (1=1) (2=1) (3=2) (4=2) (5=3) (6=3) (ELSE=SYSMIS) INTO Age2.
EXECUTE.

Where code 1 and 2 becomes code 1 and where code 3 and 4 becomes code 2 and so on !!!

You finish by writting down the values of the new variable AGE2 !

Who is online

Users browsing this forum: No registered users and 1 guest

cron