Hi I have below dataset:
ID Value
1 A,B,C
2 D,E,F,G,H
I want output as below:
ID Value
1 A
1 B
1 C
2 D
2 E
2 F
2 G
2 H
Can somebody help me with this.??
data want;
set have;
do i=1 to countw(value,',');
newvalue=scan(value,i);
output;
end;
drop i value;
run;
data want;
set have;
do i=1 to countw(value,',');
newvalue=scan(value,i);
output;
end;
drop i value;
run;
@Son_Of_Krypton wrote:
How we can do without using do loop.??
What is wrong with a loop? That is one of the basic tools for dealing with multiple similar items.
@Son_Of_Krypton wrote:
How we can do without using do loop.??
With great difficulty, if it even is possible at all.
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 lock in 2025 pricing—just $495!
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.