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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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