Search notes:

SAS statements: file

Within a data step, the file statement specifies the file that is to be written to for the following put statements.
FILE file-spec <options> <host-options>;
file-spec identifies the destination. It is one of

Change destination of put

By default, a put statement writes into the log. The destination can be changed with the file statement:
data _null_;

  file 's:\tq84\some-file.txt';
  put "foo" "bar" "baz";
  put "one" "two" "three";
  put "x" "y" "z";

run;
Github repository about-SAS, path: /programming/statements/file/write-to-text-file.sas
Using file creates a new file by default. In order to append to an existing file, the mod option must be used: file 'p:\ath\to\file.txt' ~mod~.

See also

SAS statements

Index