Duplicate question. @shiv999 please don't post a question more than once. Everyone should respond at https://communities.sas.com/t5/SAS-Procedures/Replace-name-with-latest-entry/td-p/696461
Assuming dataset have beed sort by ID , Date.
data have;
input Id Name $ Doj :date9. dot:date9.;
format doj dot date9.;
cards;
11235 Jim 12jul2017 01aug2018
11235 Jim. 12jul2019 01aug2019
11235 Jimcarod 12jan2020 01feb2020
11235 Jimcarod 12jul2020 01aug2020
;
data want;
do until(last.id);
set have;
by id;
end;
_name=name;
do until(last.id);
set have;
by id;
name=_name;output;
end;
drop _name;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.