<?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 Function dim in macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527298#M143727</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can we use the dim function&amp;nbsp; to define the size of vector in a macro ? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2019 13:56:09 GMT</pubDate>
    <dc:creator>mansour_ib_sas</dc:creator>
    <dc:date>2019-01-15T13:56:09Z</dc:date>
    <item>
      <title>Function dim in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527298#M143727</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can we use the dim function&amp;nbsp; to define the size of vector in a macro ? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 13:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527298#M143727</guid>
      <dc:creator>mansour_ib_sas</dc:creator>
      <dc:date>2019-01-15T13:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Function dim in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527303#M143731</link>
      <description>&lt;P&gt;Yes, you can put any data step command and any function in a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros are just text substitution ... instead of %macroname or &amp;amp;macrovariablename, code is substituted depending on the value of the macro or the value of the macro variable, so when this code substitution happens, you must wind up with legal valid (not erroneous) SAS code.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 14:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527303#M143731</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-15T14:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Function dim in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527307#M143734</link>
      <description>&lt;P&gt;No.&amp;nbsp; The DIM function applies to DATA step arrays only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you can use the COUNTW function, as long as you apply %SYSFUNC:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do k=1 to %sysfunc(countw(&amp;amp;macro_list));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are only mild restrictions.&amp;nbsp; Be sure that your macro variable isn't null, and the same delimiter must be used to separate all values within the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In retrospect, it looks like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;and I interpreted your question differently.&amp;nbsp; You may need to give a little more description on what you are trying to achieve.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 14:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527307#M143734</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-01-15T14:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Function dim in macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527310#M143737</link>
      <description>&lt;P&gt;Dim() is a function that expects an array as argument. Since arrays exist only in data steps, you cannot use them outside.&lt;/P&gt;
&lt;P&gt;If you want to record the size of an array, use call symput() in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set have;
array myvars {*} var:;
call symputx('dim',dim(myvars));
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Jan 2019 14:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-dim-in-macro/m-p/527310#M143737</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-15T14:08:35Z</dc:date>
    </item>
  </channel>
</rss>

