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 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 26 Mar 1999 15:18:48 -0700
Reply-To:     Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:      Re: SCL External I-O in DATA Step
Comments: To: Howard_Schreier@ITA.DOC.GOV
Content-Type: text/plain; charset=US-ASCII

Howard Schreier <Howard_Schreier@ITA.DOC.GOV> wrote:

>I am trying to use SCL functions in a DATA step to read/write >external files. It seems to almost work. > >Here is my test program: > >* Delete file if it exists; >x 'del c:\sas\test.txt'; > >data _null_; >* Associate file reference with OS filename; > rcode1 = filename('scltest','test.txt'); >* Open for output, with 80-byte fixed-format records; > file_id = fopen('scltest','O',80,'F'); >* Write an arbitrary string; > rcode3 = fput(file_id ,'A string to be written');

You need to add

rcode3a = fwrite(file_id);

The FPUT function puts a string in the file output buffer. The FWRITE function causes the buffer to be written to the file.

>* Housekeeping; > rcode4 = fclose(file_id ); > rcode5 = filename('scltest',''); >put _all_; >run;

>Second question (assumes getting past the first): What I really want >to do is mix SCL and DATA step statements. Specifically, functions >(FILENAME, FOPEN, FCLOSE) would be used for the setup and housekeeping >but INPUT/PUT statements would do the actual data transfer. Feasible?

I haven't tried that in particular, but I've tried similar things, and had no success. I think version 7 will give you the ability to read to and write from variables, not just files, which will give you the capability you want.

-- JackHamilton@FirstHealth.com Development Manager, METRICS First Health, West Sacramento, California USA

If mail to this address bounces, please wait a day and try again.


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