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

i have dataset like 

fname lname

john    kilber

 

and i want output like this 

 

fname lname

john    kilber

john    kilber

john    kilber

john    kilber

           kilber

 

 

how to do this please help me out... 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
Opal | Level 21

How about:

 

data want;

set have;

output;

output;

output;

output;

fname=' ';

output;

run;

View solution in original post

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Do loops?

data want (drop=i);
  set have;
  do i=1 to 5;
    output;
  end;
run;
Sharad_Pujari
Calcite | Level 5
yeah it will work but it will show both fname and lname record at same no of observation but i want fname 4 times and lname 5 times
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Really not the most difficuly update:

data want (drop=i);
  set have;
  do i=1 to 5;
    if i=5 then fname="";
    output;
  end;
run;
Sharad_Pujari
Calcite | Level 5
thanks
ballardw
Super User

Is there some logic that the fifth version does not have the fname? is it always to create exactly 5 records?

Sharad_Pujari
Calcite | Level 5

no suppose you are working in comany and client want output as i shown above

Astounding
Opal | Level 21

How about:

 

data want;

set have;

output;

output;

output;

output;

fname=' ';

output;

run;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Discussion stats
  • 7 replies
  • 1263 views
  • 0 likes
  • 4 in conversation