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;
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.