Your SAS programs, embedded in web apps and elsewhere

Javascript Inside of Stored Process

Accepted Solution Solved
Super Contributor
Posts: 480
Accepted Solution

Javascript Inside of Stored Process

Is there a good article on how to use Javascript inside of a SAS stored process?  I’ve been googling for it for a while.  I am using SAS 9.2.

Accepted Solutions
‎05-15-2015 10:18 AM
Super Contributor
Posts: 480

Re: Javascript Inside of Stored Process

All Replies
‎05-15-2015 10:18 AM
Super Contributor
Posts: 480

Re: Javascript Inside of Stored Process

SAS Employee
Posts: 10

Re: Javascript Inside of Stored Process

Another way to think about using HTML5/Javascript with a SAS Stored Process is to create the HTML5/Javascript as separate assets and use the SP as a preprocessor. The SPs job is to read in the HTML5/Javascript, perform substitutions and send results to _Webout, (aka the browser )

A Stored Process that does just this is shown here, as represented in DI Studio

The “Serve page” transformation reads in the “Price manager portal.html” file, performs a bit of substitution and sends the results to _Webout. The SAS code looks like this:

%let _INFILE1_name =&_UnionP_Datamart_path/Web pages/Price manager portal.html;
data _null_;
file _webout;
infile "&_INFILE1_name" truncover;
input line $char2048.;
line = resolve(line); /* Macro substitution */
len = length(line);
put line varying2048. len;

The .html file is created using web page design tool, in this case Microsoft’s Web Expressions. It also contains a Javascript section which was built using a Javascript tool, in this case JetBrains Webstorm. Inside the .html file special markers are placed which are substituted by the “Serve page” transformation. You can see an example in this snippet of html:

<h1 class="displayed">
    <table style="width: 100%">
                <div class="iconTopDivClass">
                    <img alt="" src="http://&_WebServer:&_WebServerPort/UnionP_Pricing/Images/Modification.jpg" style="width:100%;height:100%;" />
            <td style="width: 100%">Price modification request<br>routed for

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 2 in conversation