Help using Base SAS procedures

How to duplicate a line

Reply
Contributor
Posts: 23

How to duplicate a line

Hi I have data in groups by specific dates and would like to duplicate the last line of observations for each group.  For example, the first group has 10 observations for a certain date, and I would like the 11th line to be an exact duplicate of the 10th line.  And I would like to do this for every group.  Thank you for your help!

Super User
Posts: 17,831

Re: How to duplicate a line

proc sort data=have; by group date; run;

data want;

set have;

by group;

if last.group then output;

output;

run;

Ask a Question
Discussion stats
  • 1 reply
  • 147 views
  • 0 likes
  • 2 in conversation