Start with this:
data want;
set have;
v2 = compress(var2, "-");
if anydigit(v2) and not anyalpha(trimn(v2)) then do;
if missing(var3) then do;
call missing(var2);
output;
var1 = v2;
output;
end;
else do;
call missing(var2);
v3 = var3;
call missing(var3);
output;
var3 = v3;
output;
var1 = v2;
call missing(var3);
output;
var3 = v3;
output;
end;
end;
else output;
drop v2 v3;
run;
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.