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 (March 1999, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 30 Mar 1999 07:22:48 -0500
Reply-To:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:   SCL External I-O in DATA Step
Content-Type:   text/plain; charset=US-ASCII

Thanks to Jack Hamilton, Peter Crawford, and Babatunde Ashiru for pointing out that I needed to invoke the FWRITE function following the FPUT function. Jack won the race though (his post timestamped all of 17 minutes after mine); as people keep saying, SAS-L is marvelous.

Peter asked "why mixing scl and regular datastep file handling improves anything".

I turned to SCL because I want to change external file references *during* DATA step execution. My first choice was the FILEVAR option, but (a) it only permits changing the "physical" file name and I also want to change some other things (options) coded on the FILENAME statement and (b) it does not seem to work for the particular devices/methods I am using.

I can use straight SCL rather than mixing, but I suspected that performance would suffer. I experimented by generating a million records both ways (code shown below). I ran this repeatedly and the times varied on my desktop system, but the SCL always took roughly 35 percent longer. I can live with that. My initial tests suggest that mixing can work, but if it doesn't I'll just use SCL to do the I-O.

Here are the two data steps. The first one also serves as an example of the sequence of function calls which will open a file, write to it, and close it.

data _null_; * SCL; rcode1 = filename('scltime','scltime.txt'); file_id = fopen('scltime','O'); do i = 1 to 1000000; rcode2 = fput(file_id ,put(i,z7.)); rcode3 = fwrite(file_id); end; rcode4 = fclose(file_id ); rcode5 = filename('scltime',''); run;

data _null_; * Traditional input-output; file 'tiotime.txt'; do i = 1 to 1000000; put i z7.; end; run;


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