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).
INPUT pt @5 Indic $1. @7 Cmverb $1. @9 Cmpref $1.;
101 Y X .
101 . . z
101 . X z
102 N . .
DATA GOod_PT (KEEP=PT GoodToGo);
ARRAY CharVar Indic Cmverb Cmpref;
DO OVER CharVar;
IF (CharVar EQ '.') THEN CharVar = '';
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';
MERGE TestData Good_PT;
PROC PRINT DATA=TestData; RUN;
Regards - Jim.
Jim Groeneveld, Netherlands
Statistician, SAS consultant
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:
>pt indic cmverb cmpref
>101 Y X
>101 X z
>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..