<?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 how can I use an array dimension in a macro? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50781#M13870</link>
    <description>%macro aaaa();&lt;BR /&gt;
data a;&lt;BR /&gt;
array new{4} score1-score4;&lt;BR /&gt;
%do i=1 %to dim(new) %by 1;&lt;BR /&gt;
new{i}=10;&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=a;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend aaaa;&lt;BR /&gt;
%aaaa();&lt;BR /&gt;
&lt;BR /&gt;
log window:&lt;BR /&gt;
MPRINT(AAAA): array new{4} score1-score4;&lt;BR /&gt;
&lt;U&gt;ERROR: Required operator not found in expression: dim(new)&lt;BR /&gt;
ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;
ERROR: The macro AAAA will stop executing.&lt;/U&gt;</description>
    <pubDate>Tue, 02 Feb 2010 14:26:47 GMT</pubDate>
    <dc:creator>hyqwel</dc:creator>
    <dc:date>2010-02-02T14:26:47Z</dc:date>
    <item>
      <title>how can I use an array dimension in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50781#M13870</link>
      <description>%macro aaaa();&lt;BR /&gt;
data a;&lt;BR /&gt;
array new{4} score1-score4;&lt;BR /&gt;
%do i=1 %to dim(new) %by 1;&lt;BR /&gt;
new{i}=10;&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=a;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend aaaa;&lt;BR /&gt;
%aaaa();&lt;BR /&gt;
&lt;BR /&gt;
log window:&lt;BR /&gt;
MPRINT(AAAA): array new{4} score1-score4;&lt;BR /&gt;
&lt;U&gt;ERROR: Required operator not found in expression: dim(new)&lt;BR /&gt;
ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;
ERROR: The macro AAAA will stop executing.&lt;/U&gt;</description>
      <pubDate>Tue, 02 Feb 2010 14:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50781#M13870</guid>
      <dc:creator>hyqwel</dc:creator>
      <dc:date>2010-02-02T14:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: how can I use an array dimension in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50782#M13871</link>
      <description>Suggest you use a macro variable declared with a %LET statement to identify the maximum array element/variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Recommended Google advanced search argument this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
using macro variables site:sas.com</description>
      <pubDate>Tue, 02 Feb 2010 15:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50782#M13871</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-02T15:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: how can I use an array dimension in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50783#M13872</link>
      <description>I could be wrong but I think you want to use the regular data step do loop instead of %do.  %Do is something you should use if you want to iterate blocks of code such as series of data steps or procs.  I dont think %do can access the array in the data step.</description>
      <pubDate>Tue, 02 Feb 2010 15:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50783#M13872</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-02-02T15:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: how can I use an array dimension in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50784#M13873</link>
      <description>You are right. Thanks!</description>
      <pubDate>Tue, 02 Feb 2010 16:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-can-I-use-an-array-dimension-in-a-macro/m-p/50784#M13873</guid>
      <dc:creator>hyqwel</dc:creator>
      <dc:date>2010-02-02T16:09:14Z</dc:date>
    </item>
  </channel>
</rss>

