- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Using the ways listed below to call the SAS code in powershell script:
#Step 2: Execute the SAS code
#Start-Process SAS -ArgumentList "-sysin ""C:\Users\apal1018\Desktop\Work\PHR automation\MY\Test.sas"""
#Start-Process SAS -ArgumentList "-initstmt '%include ""C:\Users\apal1018\Desktop\Work\PHR automation\MY\Test.sas"";'"
#Start-Process SAS -ArgumentList "-initstmt 'dm editor ""fileopen """"C:\Users\apal1018\Desktop\Work\PHR automation\MY\Test.sas"""""";dm ""SUBMIT;"";'"
Start-Process sasoact.exe -ArgumentList "action=Submit datatype=SASFile filename=""C:\Users\apal1018\Desktop\Work\PHR automation\MY\Test.sas"" progid=SAS.Application.940"
Getting same error everytime:
PS C:\Users\apal1018> Start-Process sasoact.exe -ArgumentList "action=Submit datatype=SASFile filename=""C:\Users\apal1018\Desktop\Work\PHR automation\MY\Test.sas"" progid=SAS.Application.940"
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
+ Start-Process sasoact.exe -ArgumentList "action=Submit datatype=SASFi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You should run your SAS programs in batch mode from a Powershell script. See this link for how to do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This link has so many information.
Could you please help me in identifying which part we need to copy and create environment favorable for SAS codes execution in batch mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
is there any particular reason you use sasoact.exe instead of sas.exe? What happens if you execute the command in a cmd prompt? It seems that the system can't find the exe? Either specify the whole path or add the exe to the path?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You run this command:
”c:\Program Files\SASHome\SASFoundation\9.4\Sas.exe” -sysin c:\SASPrograms\prog1.sas -config ”c:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg”.