title: SAS macro quoting: pass equals sign as macro argument
body: <p>I am writing a macro that at some point calls some proc SQL code. I want the user to be able to specify arbitrary proc sql options (e.g. inobs=100 could be one of the input arguments to my macro). </p>
  
  <p>I am having a very hard time quoting an argument that has an equality '=' character. </p>
  
  <p>One of the issues is that I should also check if the macro argument is empty or not, and if it is not empty, only then add the specified options to the sql statement. </p>
  
  <p>Below is an example non-working test that does not work and throws the </p>
  
  <blockquote>
    <p>ERROR: The keyword parameter INOBS was not defined with the macro.</p>
  </blockquote>
  
  <p>I have read this (<a href="http://www2.sas.com/proceedings/sugi28/011-28.pdf" rel="nofollow">http://www2.sas.com/proceedings/sugi28/011-28.pdf</a>) and other SUGI's and tried many possible ways to quote and call the macro. </p>
  
  <p>If somebody could provide a working example of the below function it would be greatly appreciated.</p>
  
  <pre><code>options mprint mlogic;
  
  data have;
      length x $8;
      input x;
      datalines;
  one
  two
  three
  ;
  
  proc sql inobs=2;
      create table sql_output as 
              select * 
              from have;
  quit;
  
  
  %macro pass_parameter_with_equal_sign(table=, sqlOptions=);
      proc sql 
  %if "%left(%trim(&amp;sqlOptions.))" ne "" %then %do;
      &amp;sqlOptions.
  %end;
      /* the semicolon to end the proc sql statement */
      ;
          create table macro_output as 
              select * 
              from have;
      quit;
  %mend;
  
  %pass_parameter_with_equal_sign(table=have, sqlOptions=%str(inobs=2))
  
  title "SQL output:";
  proc print data=sql_output; run;
  title "Macro output:";
  proc print data=macro_output; run;
  </code></pre>