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
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';
>* 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.
> rcode4 = fclose(file_id );
> rcode5 = filename('scltest','');
>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.
Development Manager, METRICS
First Health, West Sacramento, California USA
If mail to this address bounces, please wait a day and try again.