title: Macro to assign default values, avoid collision of variable names
body: <p>Here's a small macro I want to call at the start of my macro functions.</p>
  
  <p>It is the equivalent of <code>%if not %length(&amp;x) %then %let x = &amp;val</code>.</p>
  
  <p>I want to use it as it's more readable and will help me to parse my code to build documentation (Which I need to do with regex as I can't install external softwares).</p>
  
  <pre><code>%macro def
  /*---------------------
  Assign default value
  ---------------------*/
  (_x_data_x_  /* variable name (to be passed raw without &amp;) */
  ,value       /* default value */
  );
  %if not %length(&amp;&amp;&amp;_x_data_x_) %then %let &amp;_x_data_x_ = &amp;value;
  %mend;
  </code></pre>
  
  <p>Here's how it works:</p>
  
  <pre><code>%macro test(a,b);
    %def(b,&amp;a)
    %put "&amp;b";
  %mend;
  
  %test(%str(,)); /* prints "," */
  </code></pre>
  
  <p>I chose the unusual parameter name <code>_x_data_x_</code> because the macro fails when it's fed a value equal to the parameter's name (i.e. if my <code>b</code> parameter was named <code>_x_data_x_</code>).</p>
  
  <p>Can I make it really safe, apart from choosing obscure names ?</p>