Copy excel workbook to new folder in Unix using SAS -
i attempting copy excel workbook 1 directory using sas code. have found many suggestions online, none seem work me. folders these files saved in windows folders, our sas server unix server path names must translated. need use macro in destination folder , path names have spaces in between names.
so far simplified paths without spaces or macros , have tried:
data _null_; rc=system('copy /sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx /sasdata/win_shares/corpfs01/global/data/evicore/test2/workbook.xlsx'); put rc; run;
and
x 'copy '/sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx' '/sasdata/win_shares/corpfs01/global/data/evicore/test2/test2'';
where /sasdata/win_shares/corpfs01/global/
path connects our windows r: drive.
i have tried various versions of these codes adding , deleting quotation marks around path names, none seem work. top code giving me return code of 127, if helpful.
get command work unix shell first. note unix command copy files cp
, not copy
. if filenames include embedded spaces need add quotes shell knows space part of filename.
cp \ "/sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx" \ "/sasdata/win_shares/corpfs01/global/data/evicore/test2/workbook.xlsx"
then try implement using sas code. when running commands sas helps run them using data step , pipe engine on infile
statement. can read response os might send using input
statement.
data _null_; infile 'cp "/sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx" "/sasdata/win_shares/corpfs01/global/data/evicore/test2/workbook.xlsx" ' pipe; input; put _infile_; run;
or in case since copying between sub directory of common root node make code shorter issue 2 unix commands. can use semi-colon ;
separate them.
data _null_; infile 'cd "/sasdata/win_shares/corpfs01/global/data/evicore" ;cp "test/workbook.xlsx" "test2/workbook.xlsx" ' pipe; input; put _infile_; run;
Comments
Post a Comment