Your SAS programs, embedded in web apps and elsewhere

Javascript Inside of Stored Process

Accepted Solution Solved
Reply
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
Solution
‎05-15-2015 10:18 AM
Super Contributor
Posts: 480

Re: Javascript Inside of Stored Process


All Replies
Solution
‎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


Capture.PNG
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;
run;

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

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 535 views
  • 0 likes
  • 2 in conversation