BookmarkSubscribeRSS Feed
artmorlock
Fluorite | Level 6
I have a number of data loads, reports etc that I process on a SAS windows server. I currently use .bat files to launch sas.exe and run the SAS program. I'd like to switch to Powershell scripts.

Has anyone had any experience using PowerShell to launch SAS. I'm particularly interested in passing condition codes from the SAS program back thru PowerShell to my scheduler (autosys) - want to only run job 2 if job 1 completed successfully.

Thanks in Advance
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
After searching these forums and the SAS support website, I found limited information on this topic/post. You may want to consider contacting SAS tech support directly for their input/guidance, as well as reviewing the available tech/conference references using an Internet search (and searching the forums).

Scott Barry
SBBWorks, Inc.
artmorlock
Fluorite | Level 6
Thanks Scott,
I had opened a support ticket with SAS and they suggested I post the question in the forum. I'll experiment some and post my findings.
victorbarrow
Calcite | Level 5
We are wondering if we can launch and run program in Enterprise Guide 4.2 with powershell? I can launch the program with powershell but can not "run" the programs within it.

As far as running SAS I found the following at

http://www.eggheadcafe.com/software/aspnet/32285102/questions-on-powershell.aspx

It works with SAS files, but I can not get it to work with Enterprise Guide

Start-Transcript -path 'C:\sas_works\joblog.txt'
$ErrorActionPreference="Continue"
Set-Location 'C:\program files\SAS\SAS 9.1'
.\sas.exe 'C:\sas_works\PGM1.sas'|Out-Null
$error=@($LastExitCode)
$error
if($error -ne 0)
{ "ERROR! Please recheck the SAS code.Thank You."
Stop-Transcript
Exit
}
else
{
Cat "C:\sas_works\location.txt" > "D:\location.txt"
Set-Location 'C:\sas_works'
Stop-Transcript
Exit
}
Exit

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
  • 3 replies
  • 1301 views
  • 0 likes
  • 3 in conversation