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 14:57:21 +0200
Reply-To:     "Laproi, L.G.E (Louis)" <louis.laproi@HOOGEHUYS.NL>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Laproi, L.G.E (Louis)" <louis.laproi@HOOGEHUYS.NL>
Subject:      Re: HELP - Data Manipulation
Comments: To: Ellen <erains@NERI.ORG>
Content-Type: text/plain; charset="WINDOWS-1252"

Ellen, this seems to work on your example. BTW what happens when a patient tick 3 the first time?

cull

DATA visit;

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 visit2; SET visit;

BY ID; * store last observation init 0; RETAIN before 0;

* newvar1 only to clarify; IF var1 EQ 3 THEN newvar1 = before; ELSE newvar1 = var1;

* update only when useful; IF var1 NE 3 THEN before = var1;

RUN;

proc print; run;

-----Oorspronkelijk bericht----- Van: Ellen [mailto:erains@NERI.ORG] Verzonden: woensdag 30 juli 2003 14:26 Aan: SAS-L@LISTSERV.UGA.EDU Onderwerp: HELP - Data Manipulation

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

********************************************************************** Dit e-mailbericht is alleen bestemd voor de geadresseerde(n). Gebruik door anderen is niet toegestaan. Indien u niet de" geadresseerde(n) bent wordt u verzocht de verzender hiervan op de hoogte te stellen en het bericht te verwijderen. Door de elektronische verzending kunnen aan de inhoud van dit bericht geen rechten worden ontleend. ********************************************************************** This e-mail message is intended to be exclusively for the addressee. If you are not the intended recipient you are kindly requested not to make any use whatsoever of the contents and to notify the sender immediately by returning this e-mail message. No rights can be derived from this message. **********************************************************************


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