Hi, I need to create a new variable consisting of three values 1, 2 and 3 and apply to all values to an already existing variable.
This is what I have:
A
B
C
This is what I need:
A 1
A 2
A 3
B 1
B 2
B 3
C 1
C 2
C 3
I realize this is probably an easy fix, but I can't figure it out.
Thanks for your help 🙂
just loop each record
data want;
set have;
do newvar=1 to 3;
output;
end;
run;
just loop each record
data want;
set have;
do newvar=1 to 3;
output;
end;
run;
data have;
input var1 $;
datalines;
A
B
C
;
data want;
set have;
do var2=1 to 3;
output;
end;
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.