BookmarkSubscribeRSS Feed
kzysmt
SAS Employee

I want to run a SAS program using sas studio on viya using powershell.
Please tell me the pages and methods that will be helpful.

6 REPLIES 6
kzysmt
SAS Employee
It doesn't matter if it's not a shell.
I would like to run a SAS program in Viya in some way.
gwootton
SAS Super FREQ
It's unclear to me what you want to do here.
SAS Studio is a web application, so if you were running a SAS program using SAS Studio you would not be using PowerShell.
You then say it doesn't matter if it's not a shell, you'd just like to run a SAS program in Viya, and SAS Studio would be a way to do this.
If your goal is to execute some SAS program in Viya non-interactively, you can store the program in Viya and schedule it to run or call the Job Execution REST API to run it (which could be done from anything that can send HTTP, including PowerShell).

Documentation on the Job Execution REST API can be found here:

https://developer.sas.com/apis/rest/v3.5/Compute/#job-execution
--
Greg Wootton | Principal Systems Technical Support Engineer
kzysmt
SAS Employee

thank you for your reply.

 

As you said, I want to upload the SAS program files to sas studio on viya.

 

It seems that I can upload xlsx, csv, etc. to CAS using the following command, but I don't know how to upload the SAS program.

Do you know how to upload a SAS program file using the CLI?

 

sas-admin cas tables import

gwootton
SAS Super FREQ
I don't see a plugin in sas-admin CLI that can upload a file to the files service, so you'd need to use the files service REST API as described here:

https://developer.sas.com/apis/rest/v3.5/CoreServices/#create-new-file-resource
--
Greg Wootton | Principal Systems Technical Support Engineer
AllanBowe
Barite | Level 11

You can deploy SAS programs as Jobs (accessible in SAS Drive) using the SASjs CLI:  https://cli.sasjs.io/deploy

 

We have an open issue for including Studio programs: https://github.com/sasjs/cli/issues/991

 

If your project has the budget to support this feature, we'd be happy to build it.

/Allan
MacroCore library for app developers
Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
AllanBowe
Barite | Level 11

You can run a SAS program on SPRE using the SASjs CLI.

Installation instructions: https://cli.sasjs.io/installation/
Configure your SAS target: https://cli.sasjs.io/add/
Run some code: https://cli.sasjs.io/run/

Here's a video demo of the above on Viya 4:  https://communities.sas.com/t5/SAS-Hacker-s-Hub/Hacker-tip-2-running-SAS-code-from-terminal/td-p/800...

/Allan
MacroCore library for app developers
Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Discussion stats
  • 6 replies
  • 2387 views
  • 4 likes
  • 3 in conversation