<?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 Macro in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718510#M38136</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a macro because I need a value for doing an array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;BR /&gt;select max(count(a,'#'))&lt;BR /&gt;into :max&lt;BR /&gt;from provisiones;&lt;/P&gt;&lt;P&gt;%put &amp;amp;max;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test2 (drop=_: i);&lt;BR /&gt;set b ;&lt;BR /&gt;array a(%put &amp;amp;max;);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;when I do the proc sql it´s okey and it returns me a number but when I run the next code it says that&amp;nbsp;ERROR 22-322: Syntax error, expecting one of the following: una constante entera, *.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so my value in the proc sql doesn´t look like a constant. What can i do??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance,&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 09:16:18 GMT</pubDate>
    <dc:creator>anaroca12</dc:creator>
    <dc:date>2021-02-11T09:16:18Z</dc:date>
    <item>
      <title>Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718510#M38136</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a macro because I need a value for doing an array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;BR /&gt;select max(count(a,'#'))&lt;BR /&gt;into :max&lt;BR /&gt;from provisiones;&lt;/P&gt;&lt;P&gt;%put &amp;amp;max;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test2 (drop=_: i);&lt;BR /&gt;set b ;&lt;BR /&gt;array a(%put &amp;amp;max;);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;when I do the proc sql it´s okey and it returns me a number but when I run the next code it says that&amp;nbsp;ERROR 22-322: Syntax error, expecting one of the following: una constante entera, *.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so my value in the proc sql doesn´t look like a constant. What can i do??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 09:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718510#M38136</guid>
      <dc:creator>anaroca12</dc:creator>
      <dc:date>2021-02-11T09:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718512#M38137</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/368902"&gt;@anaroca12&lt;/a&gt;&amp;nbsp;Hi and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume that you want to compute some value in PROC SQL, save that in a macro variable and set up an array in a data step with the number of entries specified by that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then use this as a template. Basically, just drop the %put statement from within the array definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select max(age) into :max
   from sashelp.class;
quit;

%put &amp;amp;max.;

data test;
   set sashelp.class;
   array a{&amp;amp;max.};
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Feb 2021 09:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718512#M38137</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-11T09:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718513#M38138</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;max;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is just a macro statement that writes the value of &amp;amp;max to the log. Aside from that, it does nothing, and results in nothing. So your statement turns out to be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array a();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is not valid syntax.&lt;/P&gt;
&lt;P&gt;You need to simply use the macro variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array a(&amp;amp;max.);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the usage of the dot, see Maxim 48.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 09:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718513#M38138</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-11T09:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718514#M38139</link>
      <description>&lt;P&gt;Yes, it´s perfect!! many thanks!! this was my first macro &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 09:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718514#M38139</guid>
      <dc:creator>anaroca12</dc:creator>
      <dc:date>2021-02-11T09:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718515#M38140</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/368902"&gt;@anaroca12&lt;/a&gt;&amp;nbsp;Cool stuff &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'm sure there are many more to come.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 09:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro/m-p/718515#M38140</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-11T09:28:39Z</dc:date>
    </item>
  </channel>
</rss>

