FAPPEND Function


FAPPEND Function

Appends the current record to the end of an external file

Category: External Files

Syntax

FAPPEND ( file-id <, cc >)

Arguments

file-id

  • specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.

cc

  • specifies a carriage control character:

    blank

    indicates that the record starts a new line.

    skips one blank line before this new line.

    -

    skips two blank lines before this new line.

    1

    specifies that the line starts a new page.

    +

    specifies that the line overstrikes a previous line.

    P

    specifies that the line is a terminal prompt.

    =

    specifies that the line contains carriage control information.

    all else

    specifies that the line record starts a new line.

Details

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.

Examples

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; 

See Also

Functions:

  • 'DOPEN Function' on page 503

  • 'FCLOSE Function' on page 519

  • 'FGET Function' on page 527

  • 'FOPEN Function' on page 550

  • 'FPUT Function' on page 557

  • 'FWRITE Function' on page 564

  • 'MOPEN Function' on page 656




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net