In the example below the physician has three records.I would like to populate the zip which has max mg for the same physician.So in this case, zip 00972 has the max mg.
physician mg zip
Peter 100 00972
peter 50 00976
peter 25 (blank)
The output :
physician mg zip
Peter 100 00972
peter 50 00972
peter 25 00972
So that I ca roll up at physician and zip level for the total mg.
I tried using this(after sorting):
data temp;
set master_cvv;
by correct_name city state zip;
if first.correct_name then x= zip;
else y = lag(X);
if x= '' then x= y;
zip1 = x;
run;
the final output looks like:
physician mg zip
Peter 100 00972
peter 50
peter 25
Two records,zip appears blank.
Any help in on this?