Traditional web-based reporting with SAS BI tools

HTML dropdown list output to macro variable

Reply
New Contributor
Posts: 2

HTML dropdown list output to macro variable

Dear all,

I need your help on a question related to the integration of a HTML dropdown list and a sas macro variable.

I try to output the value of a dropdown list in a sas global macro variable and use it later.

I do this by creating a stored process and then use it in a portlet on web reports studio.

It works but the value of the macro variable doesn't change.

The code is below:

%global VarPrompt;

ods html body=_webout(no_bottom_matter) style=sasweb path=&_tmpcat (url=&_replay); ods html close;

%macro view;

data _null_;

file _webout;

put '<script type="text/javascript" language="JavaScript">';

put ' function UpdateChart() {';

put ' document.forms["DoubleOut"].submit()';

put ' }';

put ' </script>';

put "<FORM NAME='DoubleOut' ACTION='' method='post' enctype='multipart/form-data'>";

put "<INPUT TYPE='HIDDEN' NAME='_program' VALUE='&_PROGRAM'>";

put '<table border="0" cellpadding="5">';

put '<TR> <TD valign=TOP>';

put '<select Name="Vrprmt" onChange="UpdateChart();">';

put '<option value="">Select a value </option>';


put '<option value="Value_test_1"';

%if "&VarPrompt"="Value_test_1"

  %then put " SELECTED";

put '>Value_test_1</option>';


put '<option value="Value_test_2"';

%if "&VarPrompt"="Value_test_2"

  %then put " SELECTED";

put '>Value_test_2</option>';

put '<option value="Value_test_3"';

%if "&VarPrompt"="Value_test_3"

  %then put " SELECTED";

put '>Value_test_3</option>';

put '<option value="Value_test_4"';

%if "&VarPrompt"="Value_test_4"

  %then put " SELECTED";

put '>Value_test_4</option>';


put '</SELECT></TD>';

%if %length(&VarPrompt) = 0 %then %do;

  %let VarPrompt=Value_test_1;

%end;

run;

data _null_;

file _webout;

put '</TR>';

put ' </table>';

put '</FORM>';


put "&VarPrompt";

put '<BR><BR>';

put '</BODY>';

put '</HTML>';

run;


%mend view;

%view;

Ask a Question
Discussion stats
  • 0 replies
  • 2988 views
  • 0 likes
  • 1 in conversation