<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Resolving Macro Variables that contain macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229970#M41657</link>
    <description>&lt;P&gt;Hard to tell what may be going on. Have you tried using options mprint or &amp;nbsp;adding a %put _user_; statement after the proc sql to see what your code is resolving to?&lt;/P&gt;
&lt;P&gt;Are you getting any errors? If so what are they?&lt;/P&gt;</description>
    <pubDate>Wed, 14 Oct 2015 20:28:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-10-14T20:28:10Z</dc:date>
    <item>
      <title>Resolving Macro Variables that contain macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229967#M41655</link>
      <description>&lt;P&gt;I have created a list of macro variables in a PROC SQL without error. &amp;nbsp;When I create the macro variables I have a list of parameters (costval) that I have created previosuly in the job. &amp;nbsp;I cannot hard code these values because they may change and I want the flexibility to pick up any new ones that are added. &amp;nbsp;I am having trouble getting the syntax right to get these values to resolve in a DATA step further down the line. &amp;nbsp;How do I get these costvals to resolve? &amp;nbsp;Any help would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sql noprint ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; select %do i = 1 %to &amp;amp;costvars ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; sum(CC_&amp;amp;&amp;amp;costval&amp;amp;i),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; %end ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; count(*), sum(TotalGTM)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;into&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; %do i = 1 %to &amp;amp;costvars ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; :ccE&amp;amp;&amp;amp;costval&amp;amp;i,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; %end ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; :ccETotal, :ccEmptyGTM&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; from work.emptycc ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt; quit ;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 20:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229967#M41655</guid>
      <dc:creator>KDLiwen</dc:creator>
      <dc:date>2015-10-14T20:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Macro Variables that contain macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229969#M41656</link>
      <description>&lt;P&gt;You might find it easier if you change the names of the macro variables that SQL creates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;:ccE&amp;amp;&amp;amp;costval&amp;amp;i,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;:ccE_&amp;amp;i,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would still have &amp;amp;costval1 - &amp;amp;costvalN that tells you how the numbers relate to the original field names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 20:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229969#M41656</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-14T20:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Macro Variables that contain macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229970#M41657</link>
      <description>&lt;P&gt;Hard to tell what may be going on. Have you tried using options mprint or &amp;nbsp;adding a %put _user_; statement after the proc sql to see what your code is resolving to?&lt;/P&gt;
&lt;P&gt;Are you getting any errors? If so what are they?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 20:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Macro-Variables-that-contain-macro-variables/m-p/229970#M41657</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-10-14T20:28:10Z</dc:date>
    </item>
  </channel>
</rss>

