BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chris_lampron
Fluorite | Level 6

I am building a stored process which begins with a custom HTML form where the user will select options with check boxes.  After the check boxes are selected, or not selected, the user will hit "Submit" and the program will continue onto another program called "TestingFile."

The HTML code for the check boxes is:

<FORM ACTION="&_URL" method="post" enctype="multipart/form-data">

<INPUT TYPE="HIDDEN" NAME="_program" VALUE="/Shared Data/SAS Testing/TestingFile">

<INPUT TYPE="HIDDEN" NAME="submit" VALUE="submitted">

<td><p class="new2"><u><i>Sample Selection:</u></i></td>

<td><p class="portal">Option1</p></td>

<td><INPUT TYPE=CheckBox name="Opt1" Value="x"></td>

<td><p class="portal">Option2</p></td>

<td><INPUT TYPE=CheckBox name="Opt2" Value="x"></td>

<td><p class="portal">Option3</p></td>

<td><INPUT TYPE=CheckBox name="Opt3" Value="x"></td>

<td><p class="portal">Options4</p></td>

<td><INPUT TYPE=CheckBox name="Opt4" Value="x"></td>

</tr>

What I want to do is have the selections made by the user carry over to the program being called when the user selects "Submit".  Do I need any other code to have the values of the options carried over, or will they carry over automatically?  In my TestingFile program, which is called after the HTML form, I try to display what the values of the options are (whether or not they selected the options) but I can't seem to get any results.  I tried to put the variables into a table and print the table, but the table comes out empty.

I'm just wondering if what I am doing is correct or if I am missing any information.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
gergely_batho
SAS Employee

If the box is not checked, the browser does not generate a name-value pair from it.

-> in the HTML request, there will be no "opt2=x".

-> the Stored Process will not receive this parameter, there will be no macro variable with this name.

link:

Tryit Editor v2.3

To check for existence of a macro variable in SAS code:

%symexist(opt2)

Also look at this link:

14861 - Parameters are not available if the "*ProcessBody;" statement is missingwhen running a Store...

View solution in original post

3 REPLIES 3
gergely_batho
SAS Employee

I think your HTML form is almost OK.

Don't forget the start of the tr tag  (<tr>), and to close the form (</form>)

First write a simple Stored Process:

%put &opt1.;

What do you see in the log? What URL do you see in the browser?

There are various ways to debug SPs. Look into the documentation of SP and Web Developers Guide.

chris_lampron
Fluorite | Level 6

Thank you for the suggestion.  I was missing the <tr>.  That seemed to get the %put &opt1; to work correctly.

I have been running this stored process in IE 10.

I tried to build on the simple stored process and check to see if the checkboxes were checked of not.  I did some conditional if/then statements that if the variable did not equal 'x' then call it something else.  If it was checked, and did have a value of 'x', use it in the %put statement.

This works fine when the box is checked, if the box is unchecked, I get the error message:

WARNING: Apparent symbolic reference Opt2 not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &Opt2 ^='x'


I have tried putting the single quotes around the 'x' as well as trying to use %bquote, but I can't seem to perform a check to see if the check box was checked by the user or not.

Any suggestions?

gergely_batho
SAS Employee

If the box is not checked, the browser does not generate a name-value pair from it.

-> in the HTML request, there will be no "opt2=x".

-> the Stored Process will not receive this parameter, there will be no macro variable with this name.

link:

Tryit Editor v2.3

To check for existence of a macro variable in SAS code:

%symexist(opt2)

Also look at this link:

14861 - Parameters are not available if the "*ProcessBody;" statement is missingwhen running a Store...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 2127 views
  • 4 likes
  • 2 in conversation