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 (February 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 Feb 2002 14:20:46 +0100
Reply-To:     Dave Sorensen <Dave.Sorensen@JUR.KU.DK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dave Sorensen <Dave.Sorensen@JUR.KU.DK>
Subject:      SV: coding a cumulative variable in univariate data
Content-Type: text/plain; charset="iso-8859-1"

Dear Jim,

Thanks for the suggestion. But the datastep's log file says: Variable First.Subj is uninitialized. The result was that all subjects =1 on the new variable (regardless of whether they had ever experienced the event).

Also, was I clear that the new variable should not =1 UNTIL the event has occurred, but should then remain=1 thereafter.

Dave

-----Oprindelig meddelelse----- Fra: Jim Groeneveld [mailto:J.Groeneveld@ITGroups.com] Sendt: Wednesday, February 20, 2002 12:54 PM Til: 'Dave Sorensen'; SAS-L@LISTSERV.UGA.EDU Emne: RE: coding a cumulative variable in univariate data

Dear Dave,

Try the following program:

DATA basic; INPUT Subj Time X; DATALINES; 1 1 0 1 2 3 1 3 0 2 1 0 2 2 0 2 3 1 ; RUN;

PROC SORT DATA=basic; BY Subj Time; RUN;

DATA cumul; SET basic; BY Subj Time; RETAIN EverX; IF (First.Subj) THEN EverX = 0; IF (X GT 0) THEN EverX = 1; RUN;

PROC PRINT DATA=cumul; RUN;

Regards - Jim. -- Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070 senior statistician, P.O. Box 1 fax. +31 412 407 080 senior data manager 5350 AA BERGHEM IMRO TRAMARKO: a CRO J.Groeneveld@ITGroups.com the Netherlands in clinical research

As time elapses it is getting later.

Notice of confidentiality: this e-mail may contain confidential information intended for the addressed recipient only. If you have received this e-mail in error please delete this e-mail and please notify the sender so that proper delivery can be arranged.

> -----Original Message----- > From: Dave Sorensen [SMTP:Dave.Sorensen@JUR.KU.DK] > Sent: Wednesday, February 20, 2002 12:27 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: coding a cumulative variable in univariate data > > Dear SAS-L, > > I have a univariate data set where each subject-wave is a separate > observation. > > I have a variable called X. I would like to create a dummy variable > called > EVERx which=1 if X is, or has ever been greater than 0. The result should > look like this. > > SUBJ TIME X EVERx > 1 1 0 0 > 1 2 3 1 > 1 3 0 1 > 2 1 0 0 > 2 2 0 0 > 2 3 1 1 > > Is there a simple way to code this with the data in univariate format, or > do > I need to transform the data to multivariate format, code EVERx wave to > wave, and then transform it back to univariate format? > > Thanks in advance! > > Dave Sorensen


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