batch file using sas command line

Reply
Occasional Contributor
Posts: 18

batch file using sas command line


Hi everybody,

I need to create a batch file usinng command line where I could be able to run everything from my program. I have te following program(say);

ods graphics on;

proc reg data =sashelp.class;

model weight=height;

run;

ods graphics off;

proc print data=sashelp.class;

where age>11;

run;

Could someone provide me with the detail steps to ceate a batch file so that I could get all outputs directly by running the batch file.

Thank you very much;

Ram Adhikari

Super User
Posts: 10,500

Re: batch file using sas command line

Which operating system are you running? Syntax will vary.

Occasional Contributor
Posts: 18

Re: batch file using sas command line

it is in windows

Respected Advisor
Posts: 3,889

Re: batch file using sas command line

You basically need to call the sas.exe and then pass the program location and name, location and name for the log file and so on. The syntax and parameters available to you are the same than what you can use in a .cfg file.

SAS(R) 9.3 System Options: Reference, Second Edition

As part of SAS installation a sas.bat file gets installed (under the application server) which already contains the call to sas.exe. Below DOS command line syntax for Application Server SASApp with config setting under G:\SAS\Config\Lev1\SASApp

G:\SAS\Config\Lev1\SASApp\sas.bat -sysin "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\DeployedJobs\HelloWorld.sas" -log "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\Logs\HelloWorld.log" -print "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\Output\HelloWorld.lst" -ICON -NOSPLASH

One of the things you might want to add to this is log names with a time stamp (using -LOGPARM):

SAS(R) 9.3 System Options: Reference, Second Edition

Below sample script of how to batch submit SAS code out of another SAS Program using SYSTASK SAS(R) 9.3 Companion for Windows

If you want to run stuff this way then also lookup options XSYNC and XWAIT as well as the WAITFOR statement SAS(R) 9.3 Companion for Windows

If running under EG then the session must have option XCMD set (default is NOXCMD).

systask command 'G:\SAS\Config\Lev1\SASApp\sas.bat

  -sysin "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\DeployedJobs\HelloWorld.sas"

  -log "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\Logs\HelloWorld.log"

  -print "G:\SAS\Config\Lev1\SASApp\SASEnvironment\MyProject\Output\HelloWorld.lst"

  -ICON

  -NOSPLASH'

  status =HelloWorld

  mname =taskname

;

And here some more info found on the Web:

http://www.sascommunity.org/wiki/Batch_processing_under_Windows

P.S: Your email address appears as your username for everybody visible. May be you want to change that?

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