SAS Component Language Dictionary |
Category: | External File |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FWRITE(file-id<,cc>); |
contains the return code for the operation:
0 | |
0 |
contains the identifier that was assigned when the file was opened. If file-id is invalid, the program halts.
specifies a carriage-control character:
'0' | |
'-' | |
'1' | |
'+' | |
'P' | |
'=' |
Any other character (including a blank) starts the record on a new line.
Details |
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) with FOPEN.
Example |
Write the numbers 1 to 50 to an external file, skipping two blank lines. Then call FSLIST to display the newly created file.
/* Assign the fileref THEFILE to the external */ /* filename stored in the variable FNAME. */ rc=filename('thefile',fname); fileid=fopen('thefile','o',0,'P'); do i=1 to 50; rc=fput(fileid,put(i,2.)); if (fwrite(fileid,'-') ne 0) then do; _msg_=sysmsg(); put msg; return; end; end; rc=fclose(fileid); call fslist('thefile','cc');
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.