Is there some way to programmatically create a Stored Process, including the Stored Process code, and register the Stored Process in Metadata?

Reply
Occasional Contributor
Posts: 14

Is there some way to programmatically create a Stored Process, including the Stored Process code, and register the Stored Process in Metadata?

Our organization has the SAS Enterprise Business Intelligence Platform and we frequently use stored processes with custom input forms in the Stored Process Web Application for a variety of different purposes.  For some custom input forms, for example a form containing repeated input fields in rows and columns organized in a similar layout to a spreadsheet, we have generated the repetitive HTML code (using a "data _null_; file _webout; put '<html>all the html...</html>'; run;" kind of approach) in an outside SAS program and then manually copied and pasted that generated code into an already-created Stored Process in Management Console in order to surface the form online.  We are wondering if there would be a way to instead have one SAS program or Stored Process that, given some parameters (e.g., number and types of input fields, element id and name attribute values, input field labels, etc.), would act as a meta-level generator for other Stored Processes that would generate the Stored Process code and register the created Stored Processes in metadata so that, when one of these newly-created Stored Processes is executed, it would dynamically generate a custom input form displayed online that would fit the entered parameters.  In a sense, if I understand the term correctly, we would almost be using SAS as a content management system like WordPress or Drupal.  Does anyone have any suggestions?  Thanks!

Occasional Contributor
Posts: 9

Re: Is there some way to programmatically create a Stored Process, including the Stored Process code

If you are happy to use a Type 1 Stored Process (9.2 compatible, source code to reside in a defined directory) to programmatically create your STP, then this macro (and supporting macros) should get you well on your way.

 

 

 

Regarding the general approach, I would advise trying to separate your web content from your SAS programs as much as possible.  Some time after you made this post, Boemska released their open source html5 adapter.  I can't rate it highly enough for building web applications with SAS..

Frequent Contributor
Posts: 121

Re: Is there some way to programmatically create a Stored Process, including the Stored Process code

I think what you want to do ought to be possible using the SAS Language Interface to Metadata - documentation here-> https://support.sas.com/documentation/cdl/en/lrmeta/70119/PDF/default/lrmeta.pdf which allows you to programatically work with metadata objects. I've used this a bit and I have to warn you it isn't going to be easy - if you decide to try it I'd strongly recommend developing on a Metadata Server specifically created for the task where you won't mind if you accidentally corrupt all the metadata....

Ask a Question
Discussion stats
  • 2 replies
  • 249 views
  • 3 likes
  • 3 in conversation