The code illustrates how to append records to an existing file in SAS. It can be used to add text to the bottom of an existing file with the MOD option in the FILE statement.
The MOD option on the FILE statement is part of DATA step processing that is particularly used for appending to an existing file.
/* Create a csv file */
data _null_;
infile datalines trun;
file "/home/9to5sas/examples/file.csv";
input data :$10.;
put data;
datalines;
A
B
C
;
/* Append information to the existing file using MOD option */
data _null_;
file "/home/9to5sas/examples/file.csv" mod;
input data :$10.;
put data;
datalines;
D
E
F
;
Note the use of the PUT statement. PUT statement is used to write output to the SAS log. Here, it is used with the FILE statement to route this output to the same external file.