<?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: what is the reason we use array statement? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807253#M318231</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;You meant to say "dim(xarray)".&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 22:19:54 GMT</pubDate>
    <dc:creator>WarrenKuhfeld</dc:creator>
    <dc:date>2022-04-11T22:19:54Z</dc:date>
    <item>
      <title>what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807249#M318227</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have been given a code to dissect it and it has an array statement: what is the reason we use an array statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array mbrs(*) &amp;amp; mbr.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;blue blue&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 21:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807249#M318227</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-04-11T21:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807250#M318228</link>
      <description>&lt;P&gt;The array statement creates the references that allow use of array related syntax. If you don't define an array then you can't use one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arrays allow several things. One is if you want to do the same calculation or block of statements with a group of values then the array allows. Another is to short hand a group of variables for use in such functions as sum, mean, call missing, whichn, whichc, and many others.&lt;/P&gt;
&lt;P&gt;You can create look up values with arrays.&lt;/P&gt;
&lt;P&gt;You can parallel process several related variables such as having an array visit dates and visit results.&lt;/P&gt;
&lt;P&gt;You can write code to confuse new SAS users.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 21:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807250#M318228</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-11T21:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807251#M318229</link>
      <description>&lt;P&gt;There are several reasons but this is the most common: to perform the same statements over multiple variables. Arrays avoid having to repeat the statements for each variable. Consider this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  x1 = a * b;
  x2 = a * b;
  x3 = a * b;
  x4 = a * b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And an array version:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array xarray (*) x1 - x4;
  do i = 1 to dim(xarray);
  xarray(i) = a * b;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Both programs do exactly the same processing. The array version avoids repeating statements.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 01:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807251#M318229</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-04-12T01:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807253#M318231</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;You meant to say "dim(xarray)".&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 22:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807253#M318231</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2022-04-11T22:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807256#M318234</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;You meant to say "dim(xarray)".&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Probably the same mental block I have: Don't make array names longer than the variables by habit.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 22:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807256#M318234</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-11T22:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807271#M318243</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;&amp;nbsp;Thanks - now corrected.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 01:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807271#M318243</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-04-12T01:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: what is the reason we use array statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807276#M318248</link>
      <description>&lt;P&gt;The reason why an ARRAY is used is hard to discern without the context in which it is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general the idea is repeat the same series of statements of each variable included in the array.&amp;nbsp; I reduces the need to write wallpaper code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  array measures m1-m100;
  do over measures;
    measures=measures**2 ;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you want to reference the variable from a list based on an index into that list that is not known it advance.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  array monthly jan feb mar apr may jun jul aug sep oct nov dec;
   monthly[month(date)]=cost;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 04:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-reason-we-use-array-statement/m-p/807276#M318248</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-12T04:38:00Z</dc:date>
    </item>
  </channel>
</rss>

