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:14:51 -0400
Reply-To:   "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:   Re: Writing multiple ASCII files with dynamic filenames
Comments:   cc: Jane Folske <janecynthia@HOTMAIL.COM>
Content-Type:   text/plain

From: Jane Folske [mailto:janecynthia@HOTMAIL.COM] > I have a very large SAS dataset containing one million observations. > These observations are simulated data in random order. > I need to write out 1,000 flat ASCII text files of 1,000 observations each.

ah, Peter beat me to it, but here's an alternate view of the code, anyway.

examine the file options filename = and filevar

%LET PATH = C:\TEMP; filename PRNTFILE "&PATH."; data _NULL_; length FileVar $ 200; retain FileVar "&PATH." FileN Obs 0; do until(EndoFile); set LIBRARY.ONE_MILLION_OBS end = EndoFile; Obs+1;%*count the obs; %*increment the FileNmbr every 1000 obs; if not mod(Obs,1000) then FileN +1; file PRNTFILE filevar = FileVar mod; FileVar = "&PATH.\FILE" !! put(FileN,z4.) %*pad FileNmbr with leading zeros; !! '.txt'; put stuff=; %*do until(EOF);end; stop; run;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: Win_Pro Ver: 8.2 --> cheerful provider of UNTESTED SAS code from the Clue?Gee!Wrx <--


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