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

Could you help me to solve the following question?

 

name  count

abc       2

cde       3

def        1

......

xyz       5

 

the result I want is the following

name

abc

abc

cde

cde

cde

def

....

xyz

xyz

xyz

xyz

xyz

1 ACCEPTED SOLUTION

Accepted Solutions
Peter_C
Rhodochrosite | Level 12
Data want( keep= name ) ;
Set have ;
Do i= 1 to count ;
Output;
End ;
Run ;

View solution in original post

8 REPLIES 8
TigerAn
Calcite | Level 5

Could you help me to solve the following question?

 

name  count

abc       2

cde       3

def        1

......

xyz       5

 

the result I want is the following

name

abc

abc

cde

cde

cde

def

....

xyz

xyz

xyz

xyz

xyz

 

collinelliot
Barite | Level 11

 

data want;

    set have;

   do i = 1 to count;

       output;

   end;

run;

 

 

Reeza
Super User

Just a note that there is no need to post in multiple forums. Since you have an answer in this post, I've merged your other, identical question, with this post. 

Peter_C
Rhodochrosite | Level 12
Data want( keep= name ) ;
Set have ;
Do i= 1 to count ;
Output;
End ;
Run ;
TigerAn
Calcite | Level 5
thank you Peter!
Peter_C
Rhodochrosite | Level 12
If this is the answer you wanted, please mark it as the solution
art297
Opal | Level 21

@Peter_C: Hi Peter!  It was marked as a solution almost immediately after you posted it. I know, because I had posted basically the same solution seconds after you did, saw yours, thus delteted mine.

 

Art, CEO, AnalystFinder.com

Peter_C
Rhodochrosite | Level 12
Apols
This browser dod not make that clear

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 8 replies
  • 961 views
  • 1 like
  • 5 in conversation