Using SAS to copy a text file
sas
Solution
For SAS 9.4 and forward use the FCOPY function. Use the recfm=n (n for none or binary) to perform a true copy.
filename src "path-to-src" recfm=n;
filename dst "path-to-dst" recfm=n;
%let rc = %sysfunc(FCOPY(src,dst));
%put %sysfunc(SYSMSG());
If the filerefs do not use the recfm=n option FCOPY will treat them as a text file and thus be affected by control characters and end of file markers.
Problem
Is there a SAS procedure / function which can be used to copy a text file from one location to another? Of course this can be achieve using OS commands (%sysexec copy) but surely there must be an OS-agnostic way to do this? From what I can tell by looking at the documentation, proc copy (or proc cport) only relate to SAS files..