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 (December 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Dec 1998 08:19:00 +1000
Reply-To:     "Jindal, Shekhar [IBM GSA]" <SJindal@NITGNPSD.TELSTRA.COM.AU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Jindal, Shekhar [IBM GSA]" <SJindal@NITGNPSD.TELSTRA.COM.AU>
Subject:      Re: Sort variables within an observation
Content-Type: text/plain

Hi Peter,

1. You need to TRANSPOSE the dataset (to get the new var - DRUG and corresponding AGE). 2. Sort by RESPONDER and AGE. 3. Get rid of OBS with missing AGE. 4. (UN)TRANSPOSE it by DRUG (to give you 5 vars - DRUG1-DRUG5) - I assume that you are not interested in the _exact_ AGE at which they tried their DRUGs (If you are, then use AGE as well in this step). 5. You have your data.

The code should be easy enough (I guess).

Cheers Shekhar

---------- >From: Peter Flom >To: SAS-L@UGA.CC.UGA.EDU >Subject: Sort variables within an observation >Date: Friday, 18 December 1998 8:10 > > >I have a data set with several hundred observations. Each observation >contains (among a lot of other stuff) 5 variable corresponding to the age at >which the subject first did something. Each of these could be missing, or >range from 1 to 25. > >The "somethings" are various drugs: Marijuana, cocaine, etc. > >What I would like is, for each person, to get a data set containing which >drug the person did first, second, third, fourth, or fifth. There are a >couple complications. Each person could have done any, some, or all of the

>drugs. They could do them in any order. And they could have started doing >two (or more) at the same age, thus yielding ties. > >I could code this with "brute force", but that would take a couple hundred >lines of code. > >Does anyone have a simple or elegant solution? > >Thanks in advance > >Peter Flom >Senior Research Associate >NDRI >2 World Trade Center >NY NY 10048 > > > > >Peter.Flom@ndri.org >


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