Sample 24569: Append text to an existing file
The sample code on the Full Code tab illustrates how to add information to the bottom of an existing file with the MOD option in the FILE statement.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* Create base file */
data _null_;
infile datalines truncover;
file "C:\Temp\base_file.txt";
input fruit :$10.;
put fruit;
datalines;
apple
banana
coconut
;
run;
/* Append information to the existing file using MOD option */
data _null_;
file "c:\Temp\base_file.txt" mod;
input fruit :$10.;
put fruit;
datalines;
date
elderberry
fig
;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
OUTPUT to external file
apple
banana
coconut
date
elderberry
fig
Add information to the bottom of an existing file with the MOD option in the FILE statement.
Type: | Sample |
Topic: | Query and Reporting ==> Creating Reports ==> Non Graphical SAS Reference ==> DATA Step Common Programming Tasks ==> Reading and Writing External Data
|
Date Modified: | 2005-12-08 11:34:04 |
Date Created: | 2004-09-30 14:08:55 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |