DATA Step, Macro, Functions and more

Issue running a .cmd file using %sysexec.

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Issue running a .cmd file using %sysexec.

I have a file called outer.cmd. That file calls inner.cmd. I use the %sysexec command to call outer.cmd. However I recieve the error "inner.cmd is not recognized as an internal or external command" when SAS 9.3 runs the outer program. Is there a way around this?   


Accepted Solutions
Solution
‎01-20-2017 08:53 AM
Super User
Posts: 7,757

Re: Issue running a .cmd file using %sysexec.

My first guess would be to use fully qualified path names in the outer.cmd. inner.cmd is probably in a place not included in your %path%.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 5,424

Re: Issue running a .cmd file using %sysexec.

Does it work if call outer outside SAS (from the same directory/user/etc)?
Data never sleeps
New Contributor
Posts: 3

Re: Issue running a .cmd file using %sysexec.

The outer.cmd file calls and runs the inner.cmd file correctly if I run it outside SAS.

Solution
‎01-20-2017 08:53 AM
Super User
Posts: 7,757

Re: Issue running a .cmd file using %sysexec.

My first guess would be to use fully qualified path names in the outer.cmd. inner.cmd is probably in a place not included in your %path%.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: Issue running a .cmd file using %sysexec.

Posted in reply to KurtBremser

Thank you. This suggestion fixed my issue. Even though both files are in the same folder calling the inner file like " call inner.cmd" didn't work. Instead I needed to call it like so " call "C:\Users\user\Documents\inner.cmd"  ". 

Super User
Posts: 7,757

Re: Issue running a .cmd file using %sysexec.

You probably used a fully qualified path name for outer.cmd. But that does not imply a change directory to its location. UNIX shell scripts do often extract the path from the called commandline and change to it for that reason.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 140 views
  • 0 likes
  • 3 in conversation