DATA Step, Macro, Functions and more

X command on Windows when CMD is disabled

Reply
Frequent Contributor
Posts: 90

X command on Windows when CMD is disabled

How might I submit a batch job in SAS if the CMD (command prompt) has been disabled?  I had written the program to use an X statement.

 

The administrators have disabled CMD and before I request an exemption, I want to be sure that we do not have other routes.  I have no experience with Java, but might the data set Java object be a possible route?

 

Thank you,


Kevin

Frequent Contributor
Posts: 90

Re: X command on Windows when CMD is disabled

Posted in reply to KevinViel

Doh!

 

%sysexec works:

 

%sysexec mkdir "H:\SAS\test" ;

 

Sorry,

 

Kevin

Super User
Super User
Posts: 8,279

Re: X command on Windows when CMD is disabled

Posted in reply to KevinViel

Glad you got it to work, but note that the same option that would disable the X statement disables the %sysexec statement. There is not much difference between them.

 

It should also disable the PIPE engine.

 

 

Frequent Contributor
Posts: 90

Re: X command on Windows when CMD is disabled

Indeed, both of the following worked:

 

5389 x 'mkdir "H:\SAS\test1"' ;
5390 %put SYsrc=&SYSRC. ;
SYsrc=1
5391
5392 %sysexec mkdir "H:\SAS\test2" ;
5393
5394 %put SYsrc=&SYSRC. ;
SYsrc=1

 

The following, outside of the program that produced it as a CALL EXECUTE with an X statement, pops up a SAS session:

 

x "D:\Applications\SASHome\SASFoundation\9.4\sas.exe" -CONFIG
"D:\Applications\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" -NOSPLASH -NOSTATUSWIN -SASUSER !userprofile -SYSIN
"H:\SAS\D1\sas\one.sas" -ALTLOG "H:\SAS\D1\sas\one.log" -PRINT
"H:\SAS\D1\sas\one.lst" ;

 

On other systems/installs, this ran the program in batch mode.  I am not sure what happened in my original testing, but when I have an issue, then I pop open CMD and run the code from the command line.  X commands work, even though I cannot use CMD.  I am not sure why the session is opening.

 

Thank you,

 

Kevin

Super User
Super User
Posts: 8,279

Re: X command on Windows when CMD is disabled

Posted in reply to KevinViel

You might want to check the XWAIT and XSYNC options. 

Also the location of where SAS is actually installed can vary.

Super User
Posts: 4,025

Re: X command on Windows when CMD is disabled

Posted in reply to KevinViel

Many SAS sites use SAS Management Console for running SAS batch jobs. Have you considered that as an option? IMO it provides a much better interface if you are running a lot of batch jobs.

Frequent Contributor
Posts: 90

Re: X command on Windows when CMD is disabled

I have no experience with SAS Management Console, but I would guess that setting up the proper run would require manual interaction.

 

I guess I have to write up my macros as a PharmaSUG/SGF paper.  Programmatically, I can make short work of obtaining the files in a directory and interleaving them by hierarchy level and type (Main versus Validation).  I can check, programmatically, several results and "return codes", for instance, stop running Level 2 programs if Level 1 have certain issues.  I can have SAS email me based on various conditions or at set time points (elapsed time or programs).

 

I am not sure why so many SAS shops have a .bat file to accomplish this.  The .bat file won't work on the GRID or LSAF, for instance.  I am new to EG, but I suspect that .bat files would be useless and the macros would need to be updated.

 

I appreciate the reference.  I will be sure to review it.

 

Thank you,

 

Kevin

Ask a Question
Discussion stats
  • 6 replies
  • 124 views
  • 0 likes
  • 3 in conversation