BookmarkSubscribeRSS Feed
TimMandell
Obsidian | Level 7

Hello I'm using the method to pass variables as identified in https://support.sas.com/resources/papers/proceedings09/330-2009.pdf to try and make interdependent dropdown lists.

 

The issue I'm having is two.

 

1) The HTML drop down value being passed in like the following:

 

last, first (M.D.)

 

when the refresh java function is run the variable becomes the following:

last.

 

I think I'm missing where the special characters are being translated.

 

 

2) I don't think %sysevalf(%superq()) is processing as expected as null dropdown still provides a value

 

 

my code is like

%global whr1 whr2 prov1 prov_lst mrn1 mrn_lst dos1 dos_lst submitFunction

 

%Macro main;

 

 %if %sysevalf(%superq( prov1) ne , boolean) =1

  %let whr1 = Where provider = '&prov1.' .';

 

 proc sql ;
 select distinct cat("put '<option value=", trim(Provider), ">", trim(provider) , "</option>';")into :prov_lst separated by " " from dat.rvw_data
 &whr1 ;
 quit;

 

 proc sql ;
 select distinct cat("put '<option value=", put(DOS, mmddyy10.), ">", put(DOS, mmddyy10.) , "</option>';")into :dos_lst separated by " " from dat.rvw_data
 &whr1 ;
 quit;

 

data _null_;
file _webout;

 

put '<!DOCTYPE html>';
put '<HTML>';



put '<form name="my_form"';
put ' method="get"';
put ' action="server url">';
 
put '<input type="hidden"';
put ' name="_program"';
put ' value="metadata location">';
/* Set the default value of the Refresh_Submit variable to 0. */
put '<input type="hidden"';
put ' name="refresh_submit"';
put ' value="0">';

 

  put '<tD ><label><select name="prov1" onChange="submitFunction(0); ">';
  put "<option value='&prov1'>prov1</option>";
    &prov_lst;
  put '</select></label></tD>';

 

 proc sql ;
 select distinct cat("put '<option value=", put(DOS, mmddyy10.), ">", put(DOS, mmddyy10.) , "</option>';")into :dos_lst separated by " " from dat.rvw_data
 &whr1 ;
 quit;

 

Thank you for any input

14 REPLIES 14
ballardw
Super User

This statement has a mismatched single quote:

  %let whr1 = Where provider = '&prov1.' .';

At which point everything after becomes very suspect as to if it runs at all.

 

I don't see a %mend; statement.

Does your log show that the macro compiled successfully?

 

You may need to edit your post if the pasted example code is not as you run it.

Also the macro variable &prov1 isn't going to resolve inside single quotes for most usages. See:

%let prov1=;
%let whr1 = Where provider = '&prov1.' ;
%put &whr1.;

 Since you are apparently using the &whr1 macro to generate a where clause in Proc SQL if you want to compare the value of the dataset variable Provider to a specific text value you would want:

 

%let prov1= sometext;
%let whr1 = Where provider = "&prov1." ;
%put &whr1.;
TimMandell
Obsidian | Level 7

using " &prov1. " passes the variable but does not correct for my primary issue

 

using %superq( prov1) does the same 

 

Expected value LAST, FIRST (M.D.)

 

NOTE: Line generated by the macro variable "PROV1".

497         LAST,
_ 22 200 ERROR 22-322: Syntax error, expecting one of the following: a name, an integer constant, arrayname, #, $, &, (, +, -, /, //, :, ;, =, ?, @, @@, OVERPRINT, [, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_, {, ~.
ERROR 200-322: The symbol is not recognized and will be ignored.

ballardw
Super User

The error message without context does not indicate what is actually failing.

 

Add the line:

options mprint symbolgen;

before the macro call.

The error message should appear in the context of the code generated. Paste the log from the macro including the error message and all the MPRINT SYMBOLGEN generated statements into a code box opened with the forums {I} menu icon; The code box is important because the message windows here will reformat text moving the diagnostic characters from the log. The log will have an _ character where it detects the error. The actual error may be in lines prior but it gives us a better place to start looking.

 

You probably should include where the macro is compiled to verify that it actually compiled correctly as well.

 

TimMandell
Obsidian | Level 7

not a fan of long post but here is the mprint portion with some symbolgen.. again the issue I'm really looking to resolve are

"last, first (M>D.)"  resolving to "last," 

 

MPRINT(MAIN): select distinct cat("put '<option value=", trim(Provider), ">", trim(provider) , "</option>';")into :prov_lst separated by " " from dat.rvw_data Where provider = " LAST, " and MRN = " > " and DOS = " > " ; ERROR: Expression using equals (=) has components that are of different data types. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

MPRINT(MAIN): quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds

MPRINT(MAIN): proc sql ; SYMBOLGEN: Macro variable WHR1 resolves to Where provider = " LAST, " and MRN = " > " and DOS = " > "

MPRINT(MAIN): select distinct cat("put '<option value=", put(DOS, mmddyy10.), ">", put(DOS, mmddyy10.) , "</option>';")into :dos_lst separated by " " from dat.rvw_data Where provider = " LAST, " and MRN = " > " and DOS = " > " ; ERROR: Expression using equals (=) has components that are of different data types. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

MPRINT(MAIN): quit; NOTE: The SAS System stopped processing this step because of errors. The SAS System NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds

MPRINT(MAIN): data _null_;

MPRINT(MAIN): file _webout;

MPRINT(MAIN): put '<!DOCTYPE html>';

MPRINT(MAIN): put '<HTML>';

MPRINT(MAIN): put '<form name="my_form"';

MPRINT(MAIN): put ' method="get"';

MPRINT(MAIN): put ' action="stp url">';

MPRINT(MAIN): put '<input type="hidden"';

MPRINT(MAIN): put ' name="_program"';

MPRINT(MAIN): put ' value="stp file meta data location ">';

MPRINT(MAIN): put '<input type="hidden"';

MPRINT(MAIN): put ' name="refresh_submit"';

MPRINT(MAIN): put ' value="0">';

MPRINT(MAIN): put '<head>';

MPRINT(MAIN): put '<style>';

MPRINT(MAIN): put "th, td, input {";

MPRINT(MAIN): put "text-align: center;";

MPRINT(MAIN): put "text-wrap:unrestricted;";

MPRINT(MAIN): put "}";

MPRINT(MAIN): put "TEXTAREA[READONLY]{";

MPRINT(MAIN): put "BORDER:hidden;";

MPRINT(MAIN): put "background-color:#FFFFFF;";

MPRINT(MAIN): put "color:#000000;";

MPRINT(MAIN): put "}";

MPRINT(MAIN): put '</style>';

MPRINT(MAIN): put '<script type="text/javascript" language="JavaScript">';

MPRINT(MAIN): put 'function submitFunction(num) {';

MPRINT(MAIN): put 'if (num==1) { document.my_form.refresh_submit.value=1; }';

MPRINT(MAIN): put 'document.my_form.submit()';

MPRINT(MAIN): put '}';

MPRINT(MAIN): put'</script>';

MPRINT(MAIN): put '</HEAD>';

MPRINT(MAIN): put '<BODY>'; The SAS System

MPRINT(MAIN): put '<FORM ACTION=" ' thissrv +(-1) '" method=get>';

MPRINT(MAIN): put '<input type="hidden" name="_program" value=" ' thispgm +(-1) '">';

MPRINT(MAIN): put '<table bgcolor="#3399FF">';

MPRINT(MAIN): put '<tr>';

MPRINT(MAIN): put '<th>';

MPRINT(MAIN): put '<table align="LEFT" border="0" cellspacing="0" bgcolor="#FFFFFF" >';

MPRINT(MAIN): put '<tr>';

MPRINT(MAIN): put '<th>Provider:</th>';

MPRINT(MAIN): put '<th>MRN:</th>';

MPRINT(MAIN): put '<th>DOS:</th>';

MPRINT(MAIN): put '<th>Select:</th>';

MPRINT(MAIN): put '<th>Patient:</th>';

MPRINT(MAIN): put '<th>DOB:</th>';

MPRINT(MAIN): put '<th>Prime_Insurance:</th>';

MPRINT(MAIN): put '<th>Specialty:</th>';

MPRINT(MAIN): put '</tr>';

MPRINT(MAIN): put '<tr>';

MPRINT(MAIN): put '<tD ><label><select name="prov1" onChange="submitFunction(0); ">'; NOTE: Line generated by the macro function "SUPERQ". 201 LAST, _ 22 76

MPRINT(MAIN): put "<option value=" LAST, ">" LAST, "/option>"; SYMBOLGEN: Macro variable PROV_LST resolves to

MPRINT(MAIN): ;

MPRINT(MAIN): put '</select></label></tD>';

MPRINT(MAIN): put '<tD ><select name="MRN1" onChange="submitFunction(0); ">'; ERROR 22-322: Syntax error, expecting one of the following: a name, an integer constant, arrayname, #, $, &, (, +, -, /, //, :, ;, =, ?, @, @@, OVERPRINT, [, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_, {, ~. ERROR 76-322: Syntax error, statement will be ignored. NOTE: Line generated by the macro function "SUPERQ". 201 > _ 22 200 The SAS System

MPRINT(MAIN): put "<option value=">">" > "</option>";

MPRINT(MAIN): put "<option value="">""</option>";

MPRINT(MAIN): put '</select></label></tD>';

MPRINT(MAIN): put '<tD ><select name="dos1" onChange="submitFunction(0); ">'; NOTE: Line generated by the macro function "SUPERQ". 201 > _ 22 200

MPRINT(MAIN): put "<option value=" > ">" > " </option>";

MPRINT(MAIN): put "<option value="">""</option>"; SYMBOLGEN: Macro variable DOS_LST resolves to

MPRINT(MAIN): put '</select></label></tD><BR> <BR>';

MPRINT(MAIN): put '<TD><input type="button" value="Select" value ="slct_grp" )"/></TD>';

MPRINT(MAIN): put '<tD><input name="PT" type="text" id="PT" value = ' whr1 ' size="40" tabindex="-1" /></tD>';

MPRINT(MAIN): put '<tD><input name="DOB" type="text" id="DOB" value="00/00/0000" size="10" tabindex="-1"/></tD>';

MPRINT(MAIN): put '<tD><input name="INS" type="text" id="INS" value="LOCATION" size="20" tabindex="-1"/></tD>';

MPRINT(MAIN): put '<tD><input name="SPC" type="text" id="SPC" value="OB/GYN" size="50" tabindex="-1"/></tD>';

MPRINT(MAIN): put '</tr>';

MPRINT(MAIN): put '</table>';

MPRINT(MAIN): put '</th>';

MPRINT(MAIN): put '</tr>';

MPRINT(MAIN): put '</table>';

MPRINT(MAIN): put '</body>';

MPRINT(MAIN): put '</form>';

MPRINT(MAIN): put '</html>';

MPRINT(MAIN): Run; ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, arrayname, #, (, +, /, //, ;, @, @@, OVERPRINT, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_. ERROR 200-322: The symbol is not recognized and will be ignored. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds The SAS System 202 +quit; NOTE: %INCLUDE (level 1) ending.

 

ballardw
Super User

Your problem goes much further than the macro variable resolution:

MPRINT(MAIN): select distinct cat("put '<option value=", trim(Provider), ">", trim(provider) , "</option>';")into :prov_lst separated by " " from dat.rvw_data 
Where provider = " LAST, " and MRN = " > " and DOS = " > " ; 

ERROR: Expression using equals (=) has components that are of different data types. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

 

 

You are attempting in at least one of your variables Provider, MRN or DOS to compare text to numeric. That is what the meaning of the "different data types" tells us. And since that Proc SQL step failed everything relying on the result is going to fail since Prov_list and Dos_list are both going to be blank (or potentially not replaced if they already existed %global being potentially dangerous that way)

 

You may not like long posts but with out the start through the end of a process it gets hard to diagnose something.

 

Also posting into a code box is important. For instance this bit:

MPRINT(MAIN): put '<tD ><label><select name="prov1" onChange="submitFunction(0); ">'; NOTE: Line generated by the macro function "SUPERQ". 201 LAST, _ 22 76

MPRINT(MAIN): put "<option value=" LAST, ">" LAST, "/option>"; SYMBOLGEN: Macro variable PROV_LST resolves to

 

The _ next to the 22 should be under the offending text but isn't due to the the message window reformatting here, as well as appearing to have cut off part of the error message.

 

You should also show how you assign the value to the macro variable &prov1. I suspect that is as likely to be an issue as anything.

AT least include from the start of the macro run, which I am sure you have not since their is, at a minimum, no Proc SQL before the first Select statement. Does the log as you posted it here actually look like it did in your log?

Quentin
Super User

I'm lost. I would suggest you make a much smaller example stored process.  Like one that has:

 

%put &prov1 ;

As the code, and then see what is written to the log.


Is the problem that the value is expect is never passed as a pompt value / parameter value?

 

If this is a case where you've got some html form where a user selects a parameter value and hits submit, and that parameter gets passed in the macro variable &PROV1, then I would post the html/javascript code for a very simple web page with just one or two buttons.  Definitely some funky stuff can happen when parameters are passed via URL, and  get URLencoded, quoted, etc.  But it's hard to see what's going on from what you've posted so far.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
TimMandell
Obsidian | Level 7

I really have two issues.

1) when aI pass the varable from the HTML text box to the SAS variable the code like

%if %sysevalf(%superq( prov1) ne , boolean)

and %sysevalf(%superq( mrn1) ne , boolean)

and %sysevalf(%superq( dos1) ne , boolean) %then %do;

 

does not accurately identify varables without value to include all spaces

 

2) When the HTML drop down box selects the name Last, First (M.D.) that variable should pass into the macro variable however the macro variable only returns Last, as the variable value

below is my code for review

 

/* --- Start of code for "Program". --- */
libname dat "data location on server";

/*- first level variable include header deatil predicated by combobox responses and CSN-*/
%global whr1 whr2 prov1 prov_lst mrn1 mrn_lst dos1 dos_lst submitFunction;

%global/readonly usr=&_username;
%global/readonly srttm=&systime..;


%Macro main;

/*create the where clause*/
 %if %sysevalf(%superq( prov1) ne , boolean) 
  and %sysevalf(%superq( mrn1) ne , boolean) 
  and %sysevalf(%superq( dos1) ne , boolean)   %then %do;
  %let whr1 = Where provider = " &prov1. " and MRN = " &mrn1. " and DOS = " &dos1 ";
  %end;
  
 %else %if %sysevalf(%superq( prov1) ne , boolean)  
  and %sysevalf(%superq( dos1) ne boolean)  %then %do;
  %let whr1 = Where provider = " &prov1. " and MRN is not null and DOS = " &dos1. ";
  %end;  

 %else %if %sysevalf(%superq( prov1) ne , boolean)  
  and %sysevalf(%superq( mrn1) ne , boolean)  %then %do;
  %let whr1 = Where provider = " &prov1. " and MRN = " &mrn1. " and DOS is not null;
  %end;

 %else %if %sysevalf(%superq( mrn1) ne , boolean)  
  and %sysevalf(%superq( dos1) ne , boolean)  %then %do;
  %let whr1 = Where provider is not null and MRN = " &mrn1. " and DOS = " &dos1. ";
  %end;
  
 %else %if %sysevalf(%superq( prov1) ne , boolean)   %then %do;
  %let whr1 = Where provider = " &prov1. " and MRN is not null and DOS is not null;
  %end;

 %else %if %sysevalf(%superq( mrn1) ne , boolean)   %then %do;
  %let whr1 = Where provider is not nul and MRN = " &mrn1. " and DOS is not null;
  %end;

 %else %if %sysevalf(%superq( dos1) ne , boolean)   %then %do;
  %let whr1 = Where provider is not nul and MRN is not null and DOS = " &dos1. ";
  %end;

 %else %do;
  %let whr1 = Where provider IS NOT NULL and MRN IS NOT NULL and DOS is not null;
  %end;
/*grab begining stats and populate initial drop down boxes*/
 proc sql ;
 select distinct cat("put '<option value=", trim(Provider), ">", trim(provider) , "</option>';")into :prov_lst separated by " " from dat.rvw_data
 &whr1 ;
 quit;
/*
 proc sql noprint;
 select distinct TRIM(MRN) INTO :mrn_lst separated by "-" from dat.rvw_data
 &whr1 ;
 quit;
*/
 proc sql ;
 select distinct cat("put '<option value=", put(DOS, mmddyy10.), ">", put(DOS, mmddyy10.) , "</option>';")into :dos_lst separated by " " from dat.rvw_data
 &whr1 ;
 quit;
  

data _null_;
file _webout;

%let thissrv = symget('_url');
%let thispgm = symget('_program');

%let FRST = "openadd('1st',5)";
%let chng = "rrst('1st')";
%let ad1 ="addunder('1st',1)";
%let ad2 ="addmissed('1st',1)";

put '<!DOCTYPE html>';
put '<HTML>';

/* Create an HTML Form; Action= must correspond to the address of the */
/* SAS stored process Web application. */
put '<form name="my_form"';
put ' method="get"';
put ' action="stp url">';
/* Required hidden value, this needs to correspond to the BIP tree location */
/* of the stored process which will be called; in this case the same STP is */
/* being called. */
put '<input type="hidden"';
put ' name="_program"';
put ' value="/BI tree location">';
/* Set the default value of the Refresh_Submit variable to 0. */
put '<input type="hidden"';
put ' name="refresh_submit"';
put ' value="0">';


put '<head>';
put '<style>';
put "th, td, input {";
put "text-align: center;";
put "text-wrap:unrestricted;";
put "}";

put "TEXTAREA[READONLY]{";
put "BORDER:hidden;";
put "background-color:#FFFFFF;";
put "color:#000000;";
put "}"; 

put '</style>';

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

put 'function submitFunction(num) {';
put 'if (num==1) { document.my_form.refresh_submit.value=1; }';
put 'document.my_form.submit()';
put '}';
put'</script>';
put '</HEAD>';


put '<BODY>';
put '<FORM ACTION="
 ' thissrv +(-1) '" method=get>';
put '<input type="hidden" name="_program" value="
 ' thispgm +(-1) '">';
put '<table bgcolor="#3399FF">';
put '<tr>';
put '<th>';
put '<table align="LEFT" border="0" cellspacing="0" bgcolor="#FFFFFF" >';
 put '<tr>';
  put '<th>Provider:</th>';
  put '<th>MRN:</th>';
  put '<th>DOS:</th>';
  put '<th>Select:</th>';
  put '<th>Patient:</th>';
  put '<th>DOB:</th>';
  put '<th>Prime_Insurance:</th>';
  put '<th>Specialty:</th>';
 put '</tr>';
 put '<tr>';

/*prov list*/
  put '<tD ><label><select name="prov1" onChange="submitFunction(0); ">';
%if %sysevalf(%superq( prov1) ne , boolean)  %then %do;
  put "<option value=" %superq( prov1) ">" %superq( prov1) "/option>";
%end;

  &prov_lst;
  put '</select></label></tD>';
 
/*mrn list*/
  put '<tD ><select name="MRN1" onChange="submitFunction(0); ">';
%if %sysevalf(%superq( mrn1) ne , boolean)  %then %do;
  put "<option value="%superq( mrn1)">" %superq( mrn1) "</option>";
%end;
put "<option value="">""</option>";
  /*
  %let i = 1;
  %do %while(%qscan(&mrn_lst,&i,-) ne);
  %let n&i = %scan(&mrn_lst,&i,-);
  put %unquote(%str(%'<option value="&&n&i">&&n&i</option>%'));
  %let i = %eval(&i+1);
  %end;
  */
  put '</select></label></tD>';

/*dos list*/
  put '<tD ><select name="dos1" onChange="submitFunction(0); ">';
%if %sysevalf(%superq( dos1) ne , boolean)  %then %do;
  put "<option value=" %superq( dos1) ">" %superq( dos1) " </option>";
  %end;
  put "<option value="">""</option>";
  &dos_lst
  put '</select></label></tD><BR> <BR>';

/*populate header*/

  put '<TD><input type="button" value="Select" value ="slct_grp" )"/></TD>';
  put '<tD><input name="PT" type="text" id="PT" value = ' whr1 ' size="40" tabindex="-1" /></tD>';
  put '<tD><input name="DOB" type="text" id="DOB" value="00/00/0000" size="10" tabindex="-1"/></tD>';
  put '<tD><input name="INS" type="text" id="INS" value="Location" size="20" tabindex="-1"/></tD>';
  put '<tD><input name="SPC" type="text" id="SPC" value="OB/GYN" size="50" tabindex="-1"/></tD>';
 put '</tr>';
put '</table>';
put '</th>';
put '</tr>';
put '</table>';
put '</body>';
put '</form>';
put '</html>';

Run;


%mend main;

options mprint symbolgen;
 %main;
quit;

Quentin
Super User

If you add something like:

 

%put >>&prov1<< ;
%put >>%superq(prov1)<< ;
%put _user_ ;

What values do you see in the log?

 

That would help with understanding issue #1, because it should show the value that was passed to the macro variable.  

 

If your problem is a value that is all blanks (perhaps macro quoted blanks), your test will return false:

 

22   %let prov1=%str(    ) ;
23   %put %sysevalf(%superq(prov1) ne , boolean) ;
0

If you want to treat blanks as non-null, you can test like:

 

24   %put %eval(%length(%superq(prov1)) ne 0)  ;
1

Chung & King discuss this and more in their excellent paper on checking for blank parameter values:  http://support.sas.com/resources/papers/proceedings09/022-2009.pdf

 

 

I'm not much of an HTML/javascript form guy, so probably won't be able to help much with question #2 if that is the cause of the truncation your are seeing.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
TimMandell
Obsidian | Level 7

making it simple I see using EG the following

 

select distinct trim(provider) into :prov_lst separated by " " from dat.rvw_data

&whr1 and provider like 'LAST%';

 

quit;

 

%let prov2 =%superq(prov_lst);

 

%put &prov2

 

 

34 %let prov2 =%superq(prov_lst);

35 %put &prov2;

SYMBOLGEN: Macro variable PROV2 resolves to LAST, FIRST(M.D.)

SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.

LAST, FIRST (M.D.)

 

So I'm uncertain why when a option is selected from the HTML option box and passed to SAS variable I'm experiencing the error's as noted above.

TimMandell
Obsidian | Level 7
sorry for got to add %let whr1 = Where provider IS NOT NULL and MRN IS NOT NULL and DOS is not null;
Quentin
Super User

I'm going to stick with my earlier suggestion, at the top of your stored process, write the values of the macro variable to the log:

%put >>&prov1<< ;
%put >>%superq(prov1)<< ;
%put _user_ ;

That should help check if the macro variable is storing the value you expect, before any of the SAS stored process code has executed.  If it could be the html/javascript is not passing the value you expect to SAS.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
TimMandell
Obsidian | Level 7

how is your request not the same as

 

MPRINT(MAIN): put '<tD ><label><select name="prov1" onChange="submitFunction(0); ">'; NOTE: Line generated by the macro function "SUPERQ". 201 LAST, _ 22 76

MPRINT(MAIN): put "<option value=" LAST, ">" LAST, "/option>";

 

from an earlier post.  we see that %superq(prov1) resolves to LAST,    when we want it to resolve to LAST, FIRST (M.D.)

TimMandell
Obsidian | Level 7

Hello ballardw

 

The pseudo code reads as following  for the provider name-

 

Create an array separated spaces of dynamic code that populates an HTML drop down box called prov1.

 

When prov1 drop down box has a value change call the page refresh method.

 

Here it is tricky- prov1 is also seen by the sas code as a macro variable and is read back to the top of the code at refresh to see if it has value.

 

this is to assure that the other available drop down box values cascade appropriately.

 

when the code gets back to the drop down box we want to assure that the value selected by the user is still visible in the box so we call the variable into code for display.

 

 

 

I did have issues with the NULL values as you have pointed out and since corrected so my dynamic "where" clause acts as expected but displaying the provider name using %superq(prov1) continues to be an issue.

 

I could work around this in many ways however later in the form we plan to have a free text box so handling special characters is high importance.

 

 

 

TimMandell
Obsidian | Level 7

found it.... I'm not populating the HTML properly

 

in the SQL I use proper syntax

put '<option value=", trim(Provider), ">", trim(provider) , "</option>';

 

when calling the newly populated macro prov1  I do this

 

put "<option value="%superq( prov1) ">"%superq( prov1)"/option>";

 

I need to do this-->

 

put "<option value=", %superq( prov1) ,">", %superq( prov1) ,"/option>";

 

Thanks for looking at this with me and teaching me how to view the global mprint and symbolgyn in stored procedure method

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 14 replies
  • 2265 views
  • 0 likes
  • 3 in conversation