BookmarkSubscribeRSS Feed
Anand6666
Calcite | Level 5

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;

1 REPLY 1
Tom
Super User Tom
Super User

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1595 views
  • 0 likes
  • 2 in conversation