Error in simple SAS macro
<p>I am testing the macro loop. The code is simple but always come the error message "Macro function %SCAN has too many arguments". Could not understand the reason. Anyone could explain it? Thanks!
The code is:</p>

<pre><code>%macro test;
 proc sql;select distinct tj, max(tj) into: tp separated by ",", : maxtp from ASA_k where tj&gt;0;quit;    

 %do i=1 %to &amp;maxtp.;
  %let timep=%scan(&amp;tp.,&amp;i.,",");
  %put &amp;timep.;
 %end;

%mend;

%test;
</code></pre>