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 (July 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Jul 2002 15:09:48 -0700
Reply-To:     Cassell.David@EPAMAIL.EPA.GOV
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "David L. Cassell" <Cassell.David@EPAMAIL.EPA.GOV>
Subject:      Re: Writing multiple ASCII files with dynamic filenames
Content-type: text/plain; charset=us-ascii

Jane Folske <janecynthia@HOTMAIL.COM> wrote [in part]: > I need to write out 1,000 flat ASCII text files of 1,000 observations each. Each > of these files is to be a random sample, drawn without replacement, from the > "population" of one million observations. > Since the simulated data are in random order, there's no need for me to write code > to do the sampling; simply writing out each 1,000 records into an ASCII file > sequentially will accomplish the goal. > The filenames of the ASCII files need to include the sample number (1 through 1,000).

While Peter Crawford has already given you his usual excellent advice and code, I have another suggestion. Don't do it.

You will probably be better off keeping the data in a single data set, numbering the replicates from 0 to 999, and using a BY statement in your PROCs to separate your analyses. It should also be much faster this way. You can number the replicates in your randomly- ordered 1-million-record data set like this:

replicate = int( (_n_-1)/1000 );

Now the first 1000 have replicate=0, the next 1000 have replicate=1, etc.

HTH, David -- David Cassell, CSC Senior computing specialist mathematical statistician

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