Hi all,
Having some trouble with trying to specify multiple conditions to subset my data.
Sample:
Note: Var "XY" means -> X= 1 // Y = 2
I'm trying to isolate the data down to one row per ID. The problem are the IDs with 2 visits.
How do I indicate that if the ID has 2 visits (meaning the subject has two rows which have a Visit = 1 and Visit = 2), I want to only keep the row where "Visit=2" and the "XY" variable = 2 while not impacting the other ID's that only have 1 visit (i.e. no duplicates).
Here's what I tried but it was causing some errors:
data test;
set test;
if ID = (XY=2) & (Visit=2) then keep;
run;
Any help/tips would be appreciated!