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"

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2723 views
  • 0 likes
  • 3 in conversation