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

Adds a string to a file. More...

Go to the source code of this file.

Detailed Description

Creates an fcmp function for appending a string to an external file. If the file does not exist, it is created.

The function itself takes the following (positional) parameters:

PARAMETER DESCRIPTION
filepath $ full path to the file
string $ string to add to the file
mode $ mode of the output - either APPEND (default) or CREATE

It returns 0 if successful, or -1 if an error occured.

Usage:

%mcf_string2file(wrap=YES, insert_cmplib=YES)

data _null_;
  rc=mcf_string2file(
    "%sysfunc(pathname(work))/newfile.txt"
    , "This is a test"
    , "CREATE");
run;

data _null_;
  infile "%sysfunc(pathname(work))/newfile.txt";
  input;
  putlog _infile_;
run;
Parameters
[out]wrap=(NO) Choose YES to add the proc fcmp wrapper.
[out]insert_cmplib=(NO) Choose YES to insert the package into the CMPLIB reference.
[out]lib=(work) The output library in which to create the catalog.
[out]cat=(sasjs) The output catalog in which to create the package.
[out]pkg=(utils) The output package in which to create the function. Uses a 3 part format: libref.catalog.package

Definition in file mcf_string2file.sas.