BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am trying to run a batch file through the SAS session after it has run a SAS program. Using x command, this could be run. But what particular x command will run the bat say if I am having the batch file on a network drive “p:\sas\mybatch.bat”. I tried
X call “p:\sas\mybatch.bat”; or call system(‘cd p:\sas\mybatch.bat’), but no luck. I guess I am missing something. Could you please help me to identify my mistake.

data _null_;
command ='cd' ||'c:sas\copy_datasets.bat';
call system (command);
run;
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
You first need to read the documentation more carefully. The format for the X command does not include the "call". It would be just

x 'p:\sas\mybatch.bat';

Also, the MS-DOS "CD" command takes as it's argument a directory rather than a file name.
deleted_user
Not applicable
Thanks. That worked!!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1311 views
  • 0 likes
  • 2 in conversation