<?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 Problem when trying to declare an array in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710955#M9664</link>
    <description>&lt;P&gt;Here's some simple code that exemplifies an issue I'm having:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data;&lt;BR /&gt;array grid (3,3) row1-row3 col1-col3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the error message I receive:&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 data;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 array grid (3,3) row1-row3 col1-col3;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Too few variables defined for the dimension(s) specified for the array grid.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;What can possibly be wrong?&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Thanks,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Gene&lt;/DIV&gt;</description>
    <pubDate>Wed, 13 Jan 2021 00:33:55 GMT</pubDate>
    <dc:creator>genemroz</dc:creator>
    <dc:date>2021-01-13T00:33:55Z</dc:date>
    <item>
      <title>Problem when trying to declare an array</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710955#M9664</link>
      <description>&lt;P&gt;Here's some simple code that exemplifies an issue I'm having:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data;&lt;BR /&gt;array grid (3,3) row1-row3 col1-col3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the error message I receive:&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 data;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 array grid (3,3) row1-row3 col1-col3;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Too few variables defined for the dimension(s) specified for the array grid.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;What can possibly be wrong?&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Thanks,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Gene&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 Jan 2021 00:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710955#M9664</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2021-01-13T00:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem when trying to declare an array</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710957#M9665</link>
      <description>&lt;P&gt;The specification is (Dimension1, Dimesnion2) with the total number of values being Dimension1 * Dimension 2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So for 3x3 you have 9 values, not 6 but you've only indicated 6 names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's two examples of code that does work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
	array _grid (2, 3) row1 - row3 col1-col3;

	do i=1 to 2;

		do j=1 to 3;
			_grid(i, j)=i*j;
		end;
	end;
run;

data two;
	array _grid (3, 2) row1 - row3 col1-col3;

	do i=1 to 3;

		do j=1 to 2;
			_grid(i, j)=i*j;
		end;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299716"&gt;@genemroz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Here's some simple code that exemplifies an issue I'm having:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data;&lt;BR /&gt;array grid (3,3) row1-row3 col1-col3;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the error message I receive:&lt;/P&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;73 data;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 array grid (3,3) row1-row3 col1-col3;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR: Too few variables defined for the dimension(s) specified for the array grid.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;75 run;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;What can possibly be wrong?&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;Thanks,&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;Gene&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 00:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710957#M9665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-13T00:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem when trying to declare an array</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710969#M9666</link>
      <description>&lt;P&gt;Hmm, OK.&amp;nbsp; I mistakenly thought the names were for rows and columns. Now I realize that they are the names of the elements of the array.&amp;nbsp; Thanks for straightening me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gene&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 02:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710969#M9666</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2021-01-13T02:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem when trying to declare an array</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710980#M9667</link>
      <description>An array in SAS is just shortcut reference to variables. There isn't an object created anywhere and it doesn't really "exist", except as a method of simplifying logic for the programmer. Occasionally, I've found a need for a multi-dimensional array but those times have been few and far between to be honest, they don't have a ton of value in SAS.</description>
      <pubDate>Wed, 13 Jan 2021 03:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-when-trying-to-declare-an-array/m-p/710980#M9667</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-13T03:26:21Z</dc:date>
    </item>
  </channel>
</rss>

