I have a large SAS dataset that includes patient ID and race. This is a longitudinal dataset where each observation represents a visit to the hospital. There are many observations that are missing race information, but other visits for that same patient ID have race indicated. I used the code below to resolve any observations for a given patient ID that was missing race, as long as another visit had that information:
data need;
do until (last.id);
set have;
by id;
if not missing(race) then newrace=race;
if missing(race) then race=newrace;
output;
end;
run;
My question is - how do I record when a patient has multiple race's indicated across options? How do I determine one to be more dominant/overriding than the others (i.e. for Patient 342, there are 3 obs with race=2 and 2 obs with race=4; we want any indication of race=4 to determine that newrace=4 for all obs with Patient 342).
Thanks!