Execute a SAS program (located on UNIX/Linux) server using a UI created by RShiny


I need to create a GUI to run the SAS program available in the UNIX/Linux server. At the beginning I have started with Python. But, recently my organization is planning to move from SAS to R slowly. So, I taught to create GUI using the R instead of Python.
In the online, I found that RShiny would be handy to create the GUI.
Can some one help me on creating a GUI to

  1. List out the Programs available on a selected location.
  2. Based on the selection from the available list run the SAS program and generate the output. Whether it can be a sas listing/sas dataset/any other.

Thanks in Advance,


Interesting concept! As for listing out the programs available at a selected location, you might look at the fs package, which has some handy tools for file system operations.

Then for executing the program, you will probably need to use system() or system2() to execute the program at the system level. You could probably create a wrapper function that is more "SAS aware", and there may be packages out there that are related and which I am unfamiliar with.

As for parsing / displaying the output in Shiny, you might look at the haven package for reading SAS datasets, and there should be a way to present PDFs / etc. into Shiny as well.

I think you could find some really useful widgets / UI patterns and their code (to use as a foundation if you're interested) in the Shiny gallery here: https://shiny.rstudio.com/gallery/

As you get started, I'm sure many here would be curious to hear about your progress. Please feel free to share what you come up with, or to ask more specific questions if you run into trouble!

1 Like

Dear Cole, Thanks a lot for your reply and suggestions. I will definitely post the solution if i get it.


I did something similar.

SAS programs cannot be ran directly from command line as far as I understand, but they can be run by VB and VB can be run through command line, so the way to go is, through R call system to call VB to create a SAS COM object in which you run your code.

For my case I only had SAS enterprise guide and VB wasn't allowed in command line, so I connected to excel with package RDCOMClient, and create the SAS EG object through a VBA macro, then ran the program on this object. Quite dirty and often buggy, but that's the best i could do.

I'm on an outdated version of SAS / EG though, I know on more recent versions you can use R in SAS, but i'm not sure if it goes both ways.

I'm so sorry for your suffering. :scream: Excel + VB + SAS + R makes my head spin.

In my response I was speaking about running both R and SAS on a linux server, which definitely can execute SAS from the command line. Your work definitely gets MUCH harder if you are trying to drive SAS through EG / on Windows / etc.

If you're using EG, I suspect you have a linux server? Perhaps that is not always the case - that is how we used EG (to launch SAS jobs on the linux server). In that case, I would say strip out Windows + Excel and do it all in linux land. RStudio Server for the win :smiley:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.