yes, suppose, a patient had five operation with the types being the one u stated:
1->2->1->3->2
Then it should come out as an option 1->2->1->3->2, as Im interested in all changes
data want;
set have;
length group $ 256;
array lead lead:;
group=cats(lead(1));
do i=2 to dim(lead);
if lead(i)^=lead(i-1) then do;
group=cats(group,'->',lead(i));
end;
end;
drop i;
run;
This did help.
Thank you so much !
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.