Appends the current record to the end of an external file and
returns a value
-
file-id
-
specifies the identifier that was assigned
when the file was opened, generally by the FOPEN function.
-
cc
-
specifies a carriage control character:
FAPPEND adds the record that is currently contained
in the File Data Buffer (FDB) to the end of an external file. FAPPEND returns
a 0 if the operation was successful and
0 if it was not successful.
This example assigns the fileref MYFILE to an external
file and attempts to open the file. If the file is opened successfully, it
moves data into the File Data Buffer, appends a record, 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 rc=%sysfunc(fput(&fid,
Data for the new record));
%let rc=%sysfunc(fappend(&fid));
%let rc=%sysfunc(fclose(&fid));
%end;
%else
%do;
/* unsuccessful open processing */
%end;
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.