BookmarkSubscribeRSS Feed
bbb_NG
Fluorite | Level 6


Dear all,

     3 sentences used. only the first worked, but no error message occurred to the later 2,

     can anyone give a hand?Thx.

%sysExec  xcopy "\\133.9.206.139\bdp\43430710\Test\a.xls" "\\133.9.206.139\bdp\43430710\Test\test1" ;

%sysExec  move "\\133.9.206.139\bdp\43430710\Test\a.xls" "\\133.9.206.139\bdp\43430710\Test\test1" ;

%sysExec  copy "\\133.9.206.139\bdp\43430710\Test\a.xls" "\\133.9.206.139\bdp\43430710\Test\test1" ;

4 REPLIES 4
LinusH
Tourmaline | Level 20

Have you tried these outside SAS?

OS rc is not returned to using this method. To catch a OS return code, try FILENAME PIPE instead.

Data never sleeps
bbb_NG
Fluorite | Level 6

LinusH ,

     Thx for looking into it ,I've tried in ms-dos mode. OK

TimArm
Obsidian | Level 7

Hello. Try this and check the values of rc:

data rc;

rc=system("xcopy \\133.9.206.139\bdp\43430710\Test\a.xls \\133.9.206.139\bdp\43430710\Test\test1");

output;

rc=system("move \\133.9.206.139\bdp\43430710\Test\a.xls \\133.9.206.139\bdp\43430710\Test\test1");

output;

rc=system("copy \\133.9.206.139\bdp\43430710\Test\a.xls \\133.9.206.139\bdp\43430710\Test\test1");

output;

run;

Once you get something that works you can try it again in %sysExec, or keep the above with data _NULL_ instead of data rc (although it can be quite useful to have a work dataset where you can check the return codes).

If you have a drive mapping for \\133.9.206.139\bdp then try using that instead.

Tim

bbb_NG
Fluorite | Level 6

TimArm ,

Thx for  looking into it , the xcopy returned with value 0, the other 2 returned with "2"

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2061 views
  • 0 likes
  • 3 in conversation