You are correct that the question has been asked before the solution below has changes that take into account your requirements for the date criteria.
data have;
input ID $ Injurydate:$20. Locationofinjury $;
infile cards dlm=' ';
cards;
1 Jan02,2007 Home
1 Jan02,2007 Clinic
2 Feb01,2000 Home
2 Feb06,2000 Hospital
2 Feb01,2000 Clinic
;
data help;
set have;
if Locationofinjury="Home" then severity=1;
else if Locationofinjury="Clinic" then severity=2;
else if Locationofinjury="Hospital" then severity=3;
else severity=.;
run;
proc sort data=help;
by ID injurydate severity;
run;
data want(drop=severity);
set help;
by ID injurydate severity;
if last.injurydate;
run;