[Solved] SAS Get rid of “duplicate” variables


You can use the UPDATE statement to collapse multiple records to have the latest non-missing value.

data have ;
  input id (course1-course3) ($) ;
cards;
1 B . . 
1 . A .
1 . . A
2 C . .
2 . C .
2 . . D 
;

data want ;
  update have(obs=0) have;
  by id;
run;

solved SAS Get rid of “duplicate” variables