Hello,
I have this code I'm using to assign a flag to the worst case scenario (High or within range). (R is from a previous data step to group visits where subject is on treatment)
proc sql;
create table flg as
select distinct usubjid,
paramcd,
adt,
visit,
a1ind,
"Y" as anl02fl
from advs
where r in (1,2) and a1ind in('High','Within range') and ~missing(trtsdt)
group by usubjid, paramcd
having adt eq min(adt);
quit;
This is the spec for reference.
Set to "Y" for the worst case A1IND occurring post-baseline (including unscheduled and early termination visits) for each parameter for each subject. If multiple visits exist with the worst case, flag only the earliest occurring visit.
My question is how can I order the worst case variable A1IND so that if "High" does exist that gets higher priority over within range as at the moment I have subjects that have both values but because the visit date that has the value of "Within range" occurs before "High" that is getting incorrectly assigned the flag when it should be High as that is the worst case scenario.
... View more