DATA Step, Macro, Functions and more

Duplicate Observation

Accepted Solution Solved
Reply
SAS Employee
Posts: 73
Accepted Solution

Duplicate Observation

Is there any way to create duplicates of an observation in a dataset? I have dataset with EmpID and Entries column.  Based on Entries column I would like to
create duplicate observation.

Example:  If EmpID – 1000 has Entries = 5 then I would like the output as:

EmpIDEntries
100005
100005
100005
100005
100005

Thanks


Accepted Solutions
Solution
‎03-04-2013 11:29 AM
Respected Advisor
Posts: 4,651

Re: Duplicate Observation

Simple :

data myDataSet;

set myDataSet;

do _n_ = 1 to Entries;

output;

end;

run;

PG

PG

View solution in original post


All Replies
Solution
‎03-04-2013 11:29 AM
Respected Advisor
Posts: 4,651

Re: Duplicate Observation

Simple :

data myDataSet;

set myDataSet;

do _n_ = 1 to Entries;

output;

end;

run;

PG

PG
SAS Employee
Posts: 73

Re: Duplicate Observation


Thanks for the quick reply.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 152 views
  • 0 likes
  • 2 in conversation