Hi,
I've been tasked with a project where I have to take rather long SAS program using PCSAS (v. 9.4), and create a user application, similar to an R Shiny App.
It should be able to take input parameters, and will output statistics and graph visuals.
What is the best way to this?
Would it just be easier to just translate my code into R code and create an R shiny app?
What you are looking for on SAS 9.4 is called a Stored Process (STP). Stored Processes accept user input, produce graphs, and even allow you to download results. They're highly flexible. You can build whole webpages for them that accept user input, or you can use the pre-built stored process interfaces that are generated by creating prompts in the metadata server.
You can create these with Enterprise Guide or through the Stored Process Server, which would be the most ideal way of handling it because you can have a nice web interface to produce graphics. A great paper on this subject:
Create Your First SAS Stored Process
If you have Visual Analytics, you can bring together both Stored Processes and dashboards together so that you can create a dashboard that displays the results of your job.
In SAS Viya, the equivalent of a Stored Process is called a Viya Job. It's extremely similar to a Stored Process in 9.4. An example of this can be found in this paper:
Modernizing Scenario Analysis With SAS Viya and SAS Visual Analytics
If you only have PC SAS and no remote SAS server then I don't think stored processes are an option. You could go really old-school with the SAS Windowing Environment and the WINDOW statement. It will look very old-fashioned but is easy to understand and implement.
Also with R Shiny you would typically require a server component for shared reports.
Typically PC SAS refers to a locally installed SAS. SAS EG is a client that can connect to both SAS installed on a server or locally.
SAS EG allows you to define prompts. These prompts become then available as SAS macro variables that you can use in your code. For this to work your user needs the SAS EG project opened where the prompts are defined and of course access to the SAS code to be run.
That's o.k. for some user specific adhoc processes but not really how one should share "published" reports. If using SAS EG with a local SAS "server" each user needs to have this local SAS installation plus must be using the EG project where the prompts are defined.
Try and figure out if there isn't a server version of SAS available that will allow you to build this in a proper way (either via SAS Visual Analytics and/or stored processes).
The only way to do remote access with the software you currenly have would be to allow remote logons to your PC using the Windows Remote Desktop Connection. Then they could start a SAS session and run your SAS application. This could be problematic if you are using your PC at the same time. Many organisations restrict multi-user access to PCs and indeed remote access. A better option would be a virtual PC set up in your data centre, if that is a possibility.
The goal is to be able to have this application be accessed by other people remotely
And that's what you need a server for.
The approaches @SASKiwi mentions (remote desktop or virtual PC) are both not only sub-optimal but would likely also breach the SAS license. From memory PC SAS licenses are per user and though you would need as many licenses as there are users accessing your application.
@Patrick - Very valid points, although it may be possible to negotiate a low multi-user licence. We have something similar with our SAS Dataflux Studio licence which is limited to 3 non-dedicated users. But I agree that a server-based solution is the ideal way to go.
There is no one way to do it. It really depend on the options you have at your disposal.
1. Just base SAS at your disposal you can leverage the command line scripting of your environment, sas sysparms option to take user inputs and run the program
2. Just base SAS at your disposal you can leverage python or perl or any other programming language, sas sysparms option to take user inputs and run the program
3. SAS/AF or SAS/SCL at your disposal you can build an interactive app. to take user inputs and run sas programs. If multiple users are using the same app from the same location things might get a little tricky
4. SAS EG and SAS studio have options of a stored process. I am not very familiar with Nuances around them.
Im in the same spot. Had to use Shiny R. But I am still looking for a way to use SAS. I also have SAS enterprise but no Viya. I am thinking of wrapping in saspy and build with python, dockerize and deploy
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!
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.
Ready to level-up your skills? Choose your own adventure.