BookmarkSubscribeRSS Feed
808854
Calcite | Level 5
Hi all,
I am new to SAS programming, I have few question reagrding SAS. These questions may be not relevant or easy, but as I said before I have no clue about SAS. So, If any one can help me out it would be great.My questions are:

1. Can we run SAS Program from MS DOS command prompt. If yes, how?
I want to run SAS Program in my SSIS Package ( in SQL Server)...the best way i found is through the cmd shell, but I don't know the exact command that need to be used to execute it.
2. If we can run the SAS from cmd (MS-DOS)....can we pass parameters to it
My SAS program need some parameters to be sent while executing.....so is there a way to send parameters to my SAS and execute it in CMD (windows)

Thank you in advance, I really appreciate your help.

Sasi
5 REPLIES 5
Doc_Duke
Rhodochrosite | Level 12
I'm not sure about running from SSIS, but SAS, in general, can be run from the command prompt. There is a section about it in the SAS Companion for Windows (look at batch execution).

I know that passing parameters to a batch SAS program has been discussed in these forums, but can't find it now. If you have a lot of them to pass, it might be easier to code them as %LET macro variables and store them in a text file to %INCLUDE into the SAS program.

Doc Muhlbaier
Duke
DanielSantos
Barite | Level 11
Yep.

Running SAS in batch mode is simple as this:
[pre]
sas -sysin -sysparm ''
[/pre]
From within your script parameters are accessible through the SYSPARM macro variable.

Check the docs here:
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001283211.htm
http://support.sas.com/documentation/cdl/en/hostwin/61924/HTML/default/win-sysop-sysin.htm
http://support.sas.com/documentation/cdl/en/hostwin/61924/HTML/default/win-sysop-sysparm.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The simplest method of passing parameter data is to use the SAS run-time execution parameter SYSPARM= and you will use either the SAS automatic macro variable &SYSPARM or you can use the SAS function SYSPARM() to retrieve and parse the (optionally supplied) SYSPARM value as needed for your SAS application program.

Another technique is to write your data-strings to a sequential file and then use the SAS DATA step (or other techniques) to input those data for your processing needs.

Scott Barry
SBBWorks, Inc.
808854
Calcite | Level 5
Hey Duke,
Thanx for the reply, It was very helpful to me. I figured out that we can ran SAS through SSIS through the batch job and as you said I will implement the passing parameter passing through the text file. But my concern over here is my parameters are dynamic they vary each time so I though in the batch command it self we can send the parameters, but text file will also work for me as I can overwrite each time the parameters that I'm going to send. Thank you very much.

Sasi
808854
Calcite | Level 5
Hi Daniel and scott,
Thank you for the reply.I am able to run my SAS Routine through batch mode by passing parameter. Keep it up.U ppl are doing a gr8 job.

Cheers,
Sasi

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 3275 views
  • 0 likes
  • 4 in conversation