mp_binarycopy.sas File Reference

Copy any file using binary input / output streams. More...

Go to the source code of this file.

Detailed Description

Reads in a file byte by byte and writes it back out. Is an os-independent method to copy files. In case of naming collision, the default filerefs can be modified. Note that if you have a new enough version of SAS, and you don't need features such as APPEND, you may be better of using the fcopy() function instead.

  %mp_binarycopy(inloc="/home/me/blah.txt", outref=_webout)

To append to a file, use the mode option, eg:

filename tmp1 temp;
filename tmp2 temp;
data _null_;
  file tmp1;
  put 'stacking';
run;

%mp_binarycopy(inref=tmp1, outref=tmp2, mode=APPEND)
%mp_binarycopy(inref=tmp1, outref=tmp2, mode=APPEND)
Parameters
[in]inloc=() quoted "path/and/filename.ext" of the file to be copied
[out]outloc=() quoted "path/and/filename.ext" of the file to create
[in]inref=(____in) If provided, this fileref takes precedence over the inloc parameter
[out]outref=(____in) If provided, this fileref takes precedence over the outloc parameter. It must already exist!
[in]mode=(CREATE) Valid values:
  • CREATE - Create the file (even if it already exists)
  • APPEND - Append to the file (don't overwrite)
[in]iftrue=(1=1) Supply a condition for which the macro should be executed
Returns
nothing
Version
9.2

Definition in file mp_binarycopy.sas.