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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.