LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2009, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 29 Apr 2009 01:15:37 -0700
Reply-To:   Daniel Nordlund <djnordlund@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Daniel Nordlund <djnordlund@VERIZON.NET>
Subject:   Re: How to create a dataset by appending a single (i.e same) dataset multiple times.??
In-Reply-To:   <200904290654.n3SJwHwA009676@malibu.cc.uga.edu>
Content-type:   text/plain; charset=iso-8859-1

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of S øren Lassen > Sent: Tuesday, April 28, 2009 11:55 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: How to create a dataset by appending a single > (i.e same) dataset multiple times.?? > > While I generally recommend using proc append for appending data, > there are limits - running the append procedure one hundred times > after each other will cost a lot of overhead compared to this > solution: > > data want; > do __i=1 to 100; > do __p=1 to __n; > set A nobs=__n point=__p; > output; > end; > end; > stop; > drop __:; > run; > > Regards, > Søren > > On Tue, 28 Apr 2009 23:24:43 -0700, pinu > <amarmundankar@GMAIL.COM> wrote: > > >There is a dataset A as; > >id num > >1 11 > >2 22 > >3 33 > >Now I want to create a dataset named A which will consists > of records > >from A appended 100 times. > >Sample o/p of Dataset A will be: > >1 11 > >2 22 > >3 33 > >1 11 > >2 22 > >3 33 > >.. > >.. > >.. > >.. > >Is there any other way than using the set statement and writing A 100 > >times after that > >e.g. . data A; > > set A A A . .... ..................; > > run;

Søren,

I ran a few quick and dirty tests. The first test used a file of 100 records. The second used a file with 100000 records. With the small file, the proc append solution ran in approx 3 seconds (real time), your set with point solution ran in .09 seconds. With the large file, the proc append solution ran in 25-30 seconds and the set with point solution ran in 15-30 seconds. This is not conclusive because it was a quick and dirty test.

But I did notice two points of interest. First, as one might expect, it appears that the overhead of proc append will become a small percentage of the overall processing time as file size increases. Second, the times for both methods were quite variable, probably due to a variety of background tasks (I am running on a WinXP system). But it was interesting that the individual times for proc append with the 100k record file varied between .04 and 3.1 seconds. It would seem that the proc append could theoretically finish in as little as 4 seconds. So the overhead of running proc append may not rule out using it 100 times. The variability of these times will probably vary across systems depending on amount of ram (and how the OS manages it), type of file system, background activity, etc.

I may may try to benchmark this a little more carefully to get a better assessment of the timings for these two approaches. I would be interested in your comments (others feel free to jump in here as well).

Dan

Daniel Nordlund Bothell, WA USA


Back to: Top of message | Previous page | Main SAS-L page