Macros for SAS Application Developers
https://github.com/sasjs/core
mf_writefile.sas File Reference

Creates a text file using pure macro. More...

Go to the source code of this file.

Detailed Description

Creates a text file of up to 10 lines. If further lines are desired, feel free to create an issue, or make a pull request!

The use of PARMBUFF was considered for this macro, but it would have made things problematic for writing lines containing commas.

Usage:

%mf_writefile(&sasjswork/myfile.txt,l1=some content,l2=more content)
data _null_;
  infile "&sasjswork/myfile.txt";
  input;
  list;
run;
Parameters
[in]fpathFull path to file to be created or appended to
[in]mode=(O) Available options are A or O as follows:
  • A APPEND mode, writes new records after the current end of the file.
  • O OUTPUT mode, writes new records from the beginning of the file.
[in]l1=() First line
[in]l2=() Second line (etc through to l10)

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mf_writefile.sas.