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 (July 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Jul 2003 07:48:13 -0500
Reply-To:     greg.woolridge@TAP.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Greg Woolridge <greg.woolridge@TAP.COM>
Subject:      Re: HELP - Data Manipulation
Comments: To: Ellen <erains@NERI.ORG>
Content-type: text/plain; charset=us-ascii

This code appears to assign the value you want to var2;

data test1; input id visit $ var1; cards; 10001 6M 2 10001 12m 2 10001 24m 3 10001 36m 1 10001 60m 3 10002 1m 1 10002 12m 3 10002 36m 3 10002 48m 2 10002 60m 3 ; run;

data test2; set test1; by id; retain testvar; if first.id then testvar=.; if var1 in (1,2) then do; testvar=var1; var2=var1; end; else var2=testvar; drop testvar; run; Greg M. Woolridge Manager, Study Programming TAP Pharmaceutical Products Inc. e-mail: greg.woolridge@tap.com phone: 847-582-2332 fax: 847-582-2403

Ellen <erains@NERI.ORG To: SAS-L@LISTSERV.UGA.EDU > cc: Sent by: "SAS(r) Subject: HELP - Data Manipulation Discussion" <SAS-L@LISTSERV. UGA.EDU>

07/30/2003 07:26 AM Please respond to Ellen

I have a variable that is coded 1 = Yes 2 = No and 3 = Unchanged from last visit. I need to be able to convert all the "3" to "Yes" or "No" based on the last visit the variable was recorded as a 'Yes" or "No". A patient may have several "Unchanged from last visit" interspersed in with Yes and No answers and for each instance I have to look for the last Yes, No answer given. See data below:

ID Visit Var1 10001 6M 2 10001 12m 2 10001 24m 3 10001 36m 1 10001 60m 3 10002 1m 1 10002 12m 3 10002 36m 3 10002 48m 2 10002 60m 3

Any thoughts? Thanks


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