BookmarkSubscribeRSS Feed
KevinViel
Pyrite | Level 9

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

6 REPLIES 6
KevinViel
Pyrite | Level 9

Doh!

 

%sysexec works:

 

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

 

Sorry,

 

Kevin

Tom
Super User Tom
Super User

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.

 

 

KevinViel
Pyrite | Level 9

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

Tom
Super User Tom
Super User

You might want to check the XWAIT and XSYNC options. 

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

SASKiwi
PROC Star

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.

KevinViel
Pyrite | Level 9

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1379 views
  • 0 likes
  • 3 in conversation