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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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