Chapter Contents |
Previous |
Next |
FPUT |
Category: | External Files |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
FPUT(file-id,cval) |
Details |
FPUT returns 0 if the operation was successful, 0 if it was not successful. The number of bytes moved to the FDB is determined by the length of the variable. The value of the column pointer is then increased to one position pas t the end of the new text.
Examples |
This example assigns the fileref MYFILE to an external file and attempts to open the file in APPEND mode. If the file is opened successfully, indicated by a positive value in the variable FID, it moves data to the FDB using FPUT, ap pends a record using FWRITE, and then closes the file. Note that in a macro statement you do not enclose character strings in quotation marks.
%let filrf=myfile; %let rc=%sysfunc(filename(filrf, physical-filename)); %let fid=%sysfunc(fopen(&filrf,a)); %if &fid > 0 %then %do; %let mystring=This is some data.; %let rc=%sysfunc(fput(&fid,&mystring)); %let rc=%sysfunc(fwrite(&fid)); %let rc=%sysfunc(fclose(&fid)); %end; %else %put %sysfunc(sysmsg()); %let rc=%sysfunc(filename(filrf));
See Also |
Functions:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.