LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 25 Mar 2008 14:52:18 -0500
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: combining different variables into one
Comments: To: nfayed13@HOTMAIL.COM
Content-Type: text/plain; charset="iso-8859-1"

Nora,

This is the SAS newsgroup. Did you mean to say SAS rather than SPSS?

If so, you could probably do a simple IF statement, such as:

data set2; informat education 4.; set set1; if EDU8=1 then education=8; else if EDU7=1 then education=7; else if EDU6=1 then education=6; else if EDU5=1 then education=5; else if EDU4=1 then education=4; else if EDU3=1 then education=3; else if EDU2=1 then education=2; else if EDU1=1 then education=1; else education=.; run;

Note that I started with the highest education and worked backward.

-Mary ----- Original Message ----- From: nfayed13@HOTMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Sent: Tuesday, March 25, 2008 2:34 PM Subject: combining different variables into one

Hello:

I am new to SPSS syntax and I've searched for the answer to my question in the manual but I can't seem to find the solution to my problem. If it is there I apologize.

I am performing a secondary analysis on a database I did not create and I wish to collapse eight variables into three. The eight variables represent different levels of education, so in EDU 1 through to EDU8, if a person attained that level of education there is a 1, otherwise there is a missing variable. It looks something like this:

EDU1 EDU2 EDU3 EDU4 EDU5 EDU6 EDU7 EDU8 1 1 1 1 1 1 1

1

...and so on for about 400 cases. I wish to collapse EDU 1 & 3 together, 2, 4, 5 & 7 together, and 6 & 8 together. What should I do?

Thanks in advance,

Nora


Back to: Top of message | Previous page | Main SAS-L page