As you may have recalled, the Test5 dataset has missing values for name, sex, DOB, and group. We have to fill in those values.
data test6;
set test5;
by id;
RETAIN filledName filledSex filledDOB filledgp;
IF NOT MISSING(Name) THEN
filledName = Name; Name = filledName;
IF NOT MISSING(Sex) THEN
filledSex=Sex; Sex=filledSex;
IF NOT MISSING(DOB) THEN
filledDOB = DOB; DOB=filledDOB;
IF MISSING(Age) THEN
Age=round((Month-DOB)/365, 0.1);
IF NOT MISSING(group) THEN
filledgp = group; group=filledgp;
DROP filledName filledSex filledDOB filledgp;
RUN;