want = catx("-",scan(have,2,"-"),scan(have,1,"-"));
want = catx("-",scan(have,2,"-"),scan(have,1,"-"));
I don't think a solution exists that doesn't separate and combine, at least under the hood. Using prxchange is one way to hide the necessary steps:
want = prxchange('s/(\d+)-(\d+)/$2-$1/', 1, have);
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: