Hi,
I have been writing a report in SAS using HTML frontend.
1) I am calling a Stored procedure from another stored procedure and basically want the value of a variable defined in the first STP to be available in the called STP.
I tried declaring the variable as GLOBAL but I am unable to get the value to the second STP.
2) How to set the value of a macro variable inside javascript. when I try to do so, it throws javascript error.
Code:
%global case;
%let case=1;
data _null;
file _webout;
input;
line=resolve(_infile_);
put line;
cards4;
<html>
<head><script>
function getvalues()
{
var case=2
alert("&case");
}
function performAction(actionType)
{
if(actionType.value=="GENERATE")
{
{
var adsbmt=window.confirm("Please Wait while the System Searches for Confirmed Details!!");
}
if (adsbmt)
{document.getElementById("_PROGRAM").value="/test/Training/php_test";
document.ADD_SHARE.submit();
}';
}}
</script></head>
<body onload="getvalues()"><h1 align="center" >Report</h1>
<form name="ADD_SHARE" method="POST" action="http://****/SASStoredProcess/do">
<INPUT TYPE="HIDDEN" NAME="_PROGRAM" ID="_PROGRAM" VALUE="">
<br><br><table>
<tr><td> Enter NAME</td><td>
<input type="text" name="name"><BR> </td> </tr>
<tr></tr>
<table>
</table>
</td>
</tr>
<tr>
<td><font size="1" face="Verdana"><CENTER>
<input type="button" value="GENERATE" name="btn_update" id="GENERATE" onclick="performAction(this)" style="font-family: Verdana; font-size: 10pt; font-weight: 700"></font>';
</td>
</tr>
</table>
</form>
</body></html>
;;;;
run;
Specify the variable that the second procedure wants on the html form that is generating the URL to call it.
You could make it hidden (like the _PROGRAM variable) or not depending on how you want your form to work.
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.