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;
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.