title: SAS IML Use symget on left side
body: <p>In SAS/IML is it possible to change a variable if only a macro with its name is available? Using symget on left side produces mistake:</p>
  
  <pre><code>proc iml;
      variable = 0;
      call symput ('macVar', 'variable');
  /*  &amp;macVar = 1;*/
      symget('macVar') = 1;
      print variable;
  quit;
  
  ERROR 180-322: Statement is not valid or it is used out of proper order.
  </code></pre>
  
  <p>The <em>&amp;-sign</em> works, but the code is in a do-loop and <em>symget</em> must be used. </p>
  
  <p>The problem stems from task to write a function that accepts variable number of arguments and processes them in several do-loops. It is connected with the following questions: </p>
  
  <p><a href="https://stackoverflow.com/questions/27837613/sas-iml-use-of-mattrib-with-macro-symget-in-a-loop">SAS IML use of Mattrib with Macro (symget) in a loop</a> </p>
  
  <p><a href="https://stackoverflow.com/questions/27844612/sas-iml-pass-reference-to-variable-defined-in-macro">SAS IML pass reference to variable defined in macro</a> </p>
  
  <p><a href="https://stackoverflow.com/questions/17716726/loop-over-names-in-sas-iml">Loop over names in SAS-IML?</a></p>
  
  <p>In other languages (R, C++, Java, Matlab, etc..) the task is solved with help of abstraction.</p>
  
  <p>Ideas?</p>
  
  <hr>
  
  <p><strong>SOLVED</strong></p>
  
  <p>Thanks a lot. 
  Useful article.</p>