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.
This should work.
http://support.sas.com/resources/papers/proceedings11/257-2011.pdf
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;
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>
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.