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-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!

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