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
PROC Star

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
PROC Star

How about:

 

data want;

set have;

output;

output;

output;

output;

fname=' ';

output;

run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

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