title: Using a dynamic macro variable in a call symput statement
body: <p>I posted a question a while back about trimming a macro variable down that I am using to download a CSV from Yahoo Finance that contains variable information on each pass to the site. The code that was suggested to me to achieve this was as follows:</p>
  
  <pre><code>data _null_;
  a = "&amp;testvar.";
  call symputx('svar',trim(input(a,$8.)));
  run;
  </code></pre>
  
  <p>That worked great, however I have since needed to redesign the code so that I am declaring multiple macro variables and submitting multiple ones at the same time. </p>
  
  <p>To declare multiple macros at the same time I have used the following lines of code:</p>
  
  <pre><code>%let svar&amp;e. = &amp;svar.;
  %put stock_ticker = &amp;&amp;svar&amp;e.;
  </code></pre>
  
  <p>The varible &amp;e. is an iterative variable that goes up by one everytime. This declares what looks to be an identical macro to the one called &amp;svar. everytime they are put into the log, however the new dynamic macro is now throwing up the original warning message of:</p>
  
  <pre><code>WARNING: The quoted string currently being processed has become more than 262 characters long.  You
           may have unbalanced quotation marks.
  </code></pre>
  
  <p>That i was getting before i started using the symputx option suggested in my original problem.</p>
  
  <p>The full code for this particular nested macro is listed below:</p>
  
  <pre><code>%macro symbol_var;
  
  /*here the start row and end row created in the macro above are passed to this nested macro and then passed through the*/
  /*source dataset. at the end of the loop each ticker macro variable is defined in turn for use in the following nested*/
  /*macro, symbol by metric.*/
  
  %do e = &amp;beg_point. %to &amp;end_point. %by 1;
  
  %put stock row in dataset nasdaq ticker = &amp;e.;
  
  %global svar&amp;e;
  
  proc sql noprint;
  select symbol
  into :testvar
  from nasdaq_ticker
  where monotonic() = &amp;e.;
  quit;
  
  /*convert value to string here*/
  
  data _null_;
  a = "&amp;testvar.";
  call symputx('svar',trim(input(a,$8.)));
  run;
  
  %let svar&amp;e. = &amp;svar.;
  %put stock_ticker = &amp;&amp;svar&amp;e.;
  
  
  %end;
  %mend;
  
  %symbol_var;
  </code></pre>
  
  <p>Anyone have any suggestions how I could declare the macro &amp;&amp;svar&amp;e. directly into the call synputx step? It currently throws up an error saying that the macro variable being created cannot contain any special characters. Ive tried using &amp;QUOTE, %NRQUOTE and %NRBQUOTE but either I have used the function in an invalid context or I haven't got the syntax exactly right.</p>
  
  <p>Thanks</p>