|
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!!
|