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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.