![]() Chapter Contents |
![]() Previous |
![]() Next |
| FWRITE |
| Category: | External Files |
| Syntax | |
| Arguments | |
| Details | |
| Examples | |
| See Also |
Syntax |
| FWRITE(file-id<,cc>) |
| blank | starts the record on a new line. |
| 0 | skips one blank line before a new line. |
| - | skips two blank lines before a new line. |
| 1 | starts the line on a new page. |
| + | overstrikes the line on a previous line. |
| P | interprets the line as a terminal prompt. |
| = | interprets the line as carriage control information. |
| all else | starts the line record on a new line. |
| Details |
FWRITE returns 0
if the operation was successful,
0 if it was not successful. FWRITE moves
text from the File Data Buffer (FDB) to the external file. In order to use
the carriage control characters, you must open the file with a record format
of
P (print format) in FOPEN.
| Examples |
This example assigns the fileref MYFILE to an external file and attempts to open the file. If the file is opened successfully, it writes the numbers 1 to 50 to the external file, skipping two blank lines. 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,o,0,P));
%do i=1 %to 50;
%let rc=%sysfunc(fput(&fid,
%sysfunc(putn(&i,2.))));
%if (%sysfunc(fwrite(&fid,-)) ne 0) %then
%put %sysfunc(sysmsg());
%end;
%let rc=%sysfunc(fclose(&fid));
| See Also |
| Functions:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.