Help using Base SAS procedures

SAS running in MS DOS command prompt

Reply
New Contributor
Posts: 3

SAS running in MS DOS command prompt

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
Trusted Advisor
Posts: 2,116

Re: SAS running in MS DOS command prompt

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
Super Contributor
Posts: 474

Re: SAS running in MS DOS command prompt

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
Super Contributor
Super Contributor
Posts: 3,174

Re: SAS running in MS DOS command prompt

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.
New Contributor
Posts: 3

Re: SAS running in MS DOS command prompt

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
New Contributor
Posts: 3

Re: SAS running in MS DOS command prompt

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
Ask a Question
Discussion stats
  • 5 replies
  • 1022 views
  • 0 likes
  • 4 in conversation