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 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 11 Mar 2009 13:47:35 -0400
Reply-To:   Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject:   Re: Data Step
Comments:   To: raisins25@YAHOO.COM

Hi Zintie,

You should be more extensive to describe what you want and check your code. You talk about VT AND PT, shouldn't than be CMVERB AND CMPREF? At least that is the most obvious interpretation that I could think of. Giving that the code below might do what you want. There are more solutions (for example the so called Dow-loop).

DATA TestData; INPUT pt @5 Indic $1. @7 Cmverb $1. @9 Cmpref $1.; DATALINES; 101 Y X . 101 . . z 101 . X z 102 N . . ; RUN;

DATA GOod_PT (KEEP=PT GoodToGo); SET TestData; BY PT; ARRAY CharVar Indic Cmverb Cmpref; DO OVER CharVar; IF (CharVar EQ '.') THEN CharVar = ''; END; RETAIN Flag1 Flag2; IF (FIRST.PT) THEN DO; Flag1 = .; Flag2 = .; END; IF (Indic EQ 'Y') THEN Flag1 = 1; IF (Cmverb NE '' AND Cmpref NE '') THEN Flag2 = 1; IF (LAST.PT AND Flag1 AND Flag2) THEN DO; GoodToGo = 'Yes'; OUTPUT; END; RUN;

DATA TestData; MERGE TestData Good_PT; BY PT; RUN;

PROC PRINT DATA=TestData; RUN;

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

My computer, my wife and I will attend SGF 2009 near Washington.

On Wed, 11 Mar 2009 10:00:25 -0700, Zintie <raisins25@YAHOO.COM> wrote:

>Hi all, > > >pt indic cmverb cmpref >--------------------------------------- > >101 Y X > >101 z > >101 X z > >102 N > >I want a way to let the user know that the patient 101 is good to go >because his Indicator is Y and atleast in one record he has a non >missing VT AND PT (record 3) > >I want to know whether there is a way i can flag this patient a Yes by >iterating thru the pt list.. > >Thanks!!


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