BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Dear all,

How can I duplicate the records?

For example:

DATA TEST;
INFILE CARDS MISSOVER;
INPUT @1 ID4. @8 Factor 2. @13INVENCST COMMA10.2;
CARDS;
0001 2 45,000.00
0002 5 28,000.00
;
RUN;

If the first record of factor is 2. How can I duplicate the record by 2 times?

Finally, I want the results as following:

0001 20 45,000.00
0001 20 45,000.00
0001 10 28,000.00
0002 10 28,000.00
0002 10 28,000.00
0002 10 28,000.00
0002 10 28,000.00


Thanks all

Message was edited by: loverstar Message was edited by: loverstar
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You have the SAS OUTPUT statement which can be used in a DATA step for this purpose, as required. Without explicit coding of the OUTPUT in your example, only one SAS observation is generated. You can define a code paragraph using the construct below (coded within a DATA step):

DO I=1 TO ;
OUTPUT;
END;



Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument, this topic/post:

data step programming site:sas.com

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 521 views
  • 0 likes
  • 2 in conversation