BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Son_Of_Krypton
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
data want;
    set have;
    do i=1 to countw(value,',');
        newvalue=scan(value,i);
        output;
    end;
    drop i value;
run;
--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26
data want;
    set have;
    do i=1 to countw(value,',');
        newvalue=scan(value,i);
        output;
    end;
    drop i value;
run;
--
Paige Miller
Son_Of_Krypton
Fluorite | Level 6
How we can do without using do loop.??
ballardw
Super User

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

PaigeMiller
Diamond | Level 26

@Son_Of_Krypton wrote:
How we can do without using do loop.??

With great difficulty, if it even is possible at all.

--
Paige Miller
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1192 views
  • 0 likes
  • 3 in conversation