05-13-2014 12:47 PM
Seems there are often questions on here about "I want to make a little application with a graphical user interface for my SAS code, how can I do it?"
Was thinking it might be useful to have a thread that would summarize some of the current (and historical) approaches, and what people see as pros and cons of each.
I'm thinking historical approaches like:
More current approaches like:
Integration Technologies a la http://support.sas.com/resources/papers/proceedings13/003-2013.pdf
BI web reports
Does it seem worth the effort to ceate a thread with thoughts on this? Perhaps ultimately to become a wiki page over at http://www.sascommunity.org ? Just noticed there is no Application Development community, maybe that is worth asking for???
05-13-2014 12:50 PM
This is something I'm just getting into, basically how to provide a UI to SAS Macros without using EG.
I like the option of a thread on here.
05-13-2014 02:31 PM
On Windows I have worked with and built applications using Java, Python, C#/.NET (this would be the most relevant, usually), Ruby on Rails among others. As long as the language has good hooks to COM/ActiveX for integrating with Integration Technologies Client, then you are good to go. When you have additional tools from SAS, such as any of the tools which provide a web front-end to stored procedures, then you have that API at your disposal as well, whether that means developing inside that framework or making RESTful calls to it externally.
05-13-2014 09:28 PM
Most of the questions I see on here (and little applications I have built) are about pretty minimal interfaces. So a simple inteface that allows a user to input a few parameters (drop down boxes, radio buttons, etc.) and then invokes some program. And the program produces some report (html/pdf/rtf/etc.) which is returned to the user.
I'm thinking of threads like:
05-14-2014 11:53 AM
Once upon a time I would recommend SAS/AF but it seems that SAS is kind of ignoring that application.
Another one to look at is SAS/InterNet perhaps which doesn't require multiple users to have all kinds of licenses as I understand it.
I believe this page on Census.gov may use SAS/InterNet:
which is basically an interface to Proc Tabulate as far as I can determine. Previous versions of the site had output that actually had SAS in the description.
One thing about the site above, they have made it very difficult to actually save the results, the only way I have found is to copy paste into Excel as saving to HTM gets widgets but no output, print for many tables will not display entire results but I have to assume that is something in the way they configure the output/ page.
05-14-2014 11:53 AM
Here is a very simple GUI form for a macro submission and listing view using Python
from PySide.QtCore import *
from PySide.QtGui import *
qt_app = QApplication(sys.argv)
objFactory = win32com.client.Dispatch( 'SASObjectManager.ObjectFactoryMulti2' )
objFactory.SetMetadataFile( 'C:/Users/' + os.getenv('USERNAME') + '/AppData/Roaming/SAS/MetadataServer/oms_serverinfo2.xml' , 'C:/Users/' + os.getenv('USERNAME') + '/AppData/Roaming/SAS/MetadataServer/oms_userinfo2.xml' , False )
objSAS = objFactory.CreateObjectByLogicalName('SASApp - Logical Workspace Server' , '')
objSAS.LanguageService.Submit('%macro macroexample(gender); proc means data=sashelp.class; var height weight; where sex="&gender"; run; %mend;')
self.setWindowTitle('SAS Macro Form')
self.layout = QVBoxLayout()
self.form_layout = QFormLayout()
self.genders = ['M','F']
self.gender = QComboBox(self)
self.result = QLabel('', self)
self.button_box = QHBoxLayout()
self.build_button = QPushButton('&Run SAS', self)
objSAS.LanguageService.Submit('%macroexample(' + self.gender.currentText() + '); run;')
lst = 
lst_part = objSAS.LanguageService.FlushList( 1000 )
if not lst_part == '':
lst.append( lst_part )
app = MacroExample()
05-14-2014 01:09 PM
Appreciate your list of options for languages, as well as your Python example. I'm curious what advice you would give for the following questioner (this is not quite me, but its who I have in mind):
"I'm an experienced SAS programmer familiar with ODS etc etc. But I've never built an application that would be used by someone else. It's always been me running my code, or giving SAS code to another SAS programmer who would run it. Now I want to get into the application development game. So instead of me running a report for somebody every montth, they can run it themselves. And they can choose which subgroup they want to analyze, etc. What approach / language do you think would be easiest for me to learn/use to develop the GUI ? All I know is SAS. "
Assume this person has unlimited SAS access (so PC SAS, and BI server, and perhaps even VA ...).
Do you suggest this person go learn enough Python to write something based on your example? Or one of the other languages you listed?
For me, I've been playing with some App Development for only the past couple years. Most of it has been stored processes called by SPWA, but I haven't gotten into developing custom web interfaces, settling for the default interface generated by SPWA. When a "customer" has had PC SAS available and the data was local, I've built a few little SAS/AF apps.
But I'm at a point now where I'm considering whether I should spend more time learning web tools (not sure which, happy for suggestions), so that I could build better, prettier interfaces for my web apps (stored processes), or if I should go the Python/.NET approach and start building my "own" apps, connecting in the background to SAS Workspace Server.
Thanks again for your thoughts,
05-14-2014 01:58 PM
Here is my take on this interesting subject.
I would strongly recommend using Parametrized SAS Stored Processes (SAS Macro Programs) developed using MVC (Model-Viewer-Controller) design pattern. Here is why
MVC decouples these three objects to increase flexibility and reuse.
The typical protocol I've been using is HTTP Restful Web Services to communicate with SAS via good old SAS/IntrNet and SPWA.
Most if not all current programming languages and web frameworks support Restful Web Services, so the world is your oyster when it comes to choosing what to learn.
just my two cents,
05-14-2014 02:45 PM
There are a lot of big questions here, but I will focus first on one thing you mentioned:
"I'm an experienced SAS programmer familiar with ODS etc etc. [...] All I know is SAS. "
Developing Web Applications with SAS® Stored Processes
by Phil Mason
Outside of this most of the approach someone would take would be dictated by the project at hand and it's business requirements. If an application is necessary to build then the best place to start with no experience outside of the language of SAS would be something in the microsoft family (C#, .NET, VB, etc...) The reason here being that the Integration Technologies documentation pretty much exclusively uses them for it's examples (with the exception being the JAVA specific interface also provided by SAS, which would be the best choice if you are not building your interfaces for the Windows OS).
As Ahmed states, and I mentioned earlier in the thread also, there are not really any limitations to what direction you go in. It comes down to personal preference, the preferences of the client (or your company) and end-user of the application.
05-15-2014 11:39 AM
From this thread and your other one on using Oracle APEX I can see that you're pretty much looking to do what we've been doing for the last 3 years or so. I don't know what this forum's policy is on shameless self-promotion, but if you have a look at my profile info and check our website (/h54s) I think it'd probably help you a fair bit. Over the last few years we've developed a library that we've been using to develop some pretty sizeable operational enterprise information systems (1k+ concurrent users), using SAS as the data/analytics layer and HTML5 as the frontend. Ultimately it's similar to Phil Mason's excellent approach as suggested by just a lot simpler to use.
I suggest you get in touch with me if you want to see some examples.
05-15-2014 01:50 PM
I have similar questions. I maintain applications on PC SAS where everyone who runs it has to have SAS installed on their PC. The user interface is written in %Window. We have a relatively new BI Server available, but I'm not sure how to go about converting the %Window interface into the new tools. Is it worth looking outside the SAS ecosystem? I think the first place to start is "what are the tools your organization can/will support"? Python is open source software. Just because it's open, doesn't mean your organization will allow you to download and work with it. Even if they will, will they support it or any of the other tools mentioned? If they don't, and even if you trained up enough that you could, would an application you built with other tools survive if you left your company?
05-15-2014 02:14 PM
Lori, Within the BI server environment there is a prompting framework. Prompting is targeted to be an userinteraction.
There are two locations that are:
- metadata defined, Stored processed and information maps are supporting that.
SAS(R) 9.3 Stored Processes: Developer's Guide (Using Prompts)
Several SAS clients can take advantage of the prompt.
- Eguide defined, Sound weird but Eguide should be able to run without a full blown metadataserver present.
it is very similar http://support.sas.com/resources/papers/proceedings13/138-2013.pdf zie page 22 (flexibility).
In this case the prompt is part of the EGP.
Both are using SAS macro variables to transport the information. Please avoid reserved common macro-vars.