title: Macro returning a value
body: <p>I created the following macro. <code>Proc power</code> returns table <code>pw_cout</code> containing column <code>Power</code>. The <code>data _null_</code> step assigns the value in column <code>Power</code> of <code>pw_out</code> to macro variable <code>tpw</code>.  I want the macro to return the value of <code>tpw</code>, so that in the main program, I can call it in DATA step like:</p>
  
  <pre><code>data test;
     set tmp;
     pw_tmp=ttest_power(meanA=a, stdA=s1, nA=n1, meanB=a2, stdB=s2, nB=n2);
  run;
  </code></pre>
  
  <p>Here is the code of the macro:</p>
  
  <pre><code>%macro ttest_power(meanA=, stdA=, nA=, meanB=, stdB=, nB=);
  
  
  proc power; 
     twosamplemeans test=diff_satt 
     groupmeans = &amp;meanA | &amp;meanB 
     groupstddevs = &amp;stdA | &amp;stdB
     groupns = (&amp;nA &amp;nB)
     power = .;    
     ods output Output=pw_out;
  run;
  
  data _null_;
      set pw_out;
      call symput('tpw'=&amp;power);
  run;
  
  &amp;tpw
  %mend ttest_power;
  </code></pre>