<?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: Assigning zero values to an array in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58266#M6004</link>
    <description>From on-line doc:&lt;BR /&gt;
"When any (or all) elements are assigned initial values, all elements behave as if they were named on a RETAIN statement."&lt;BR /&gt;
&lt;BR /&gt;
In this case, it would nice to say something like:&lt;BR /&gt;
&lt;BR /&gt;
var{*} = 0;&lt;BR /&gt;
&lt;BR /&gt;
but you can't. So I guess you are stuck with doing a do loop.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
    <pubDate>Thu, 30 Oct 2008 15:24:52 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2008-10-30T15:24:52Z</dc:date>
    <item>
      <title>Assigning zero values to an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58265#M6003</link>
      <description>Hi. I would like to initialise my array by assigning each element with a zero value.  I can do this through a do loop but I thought that I could do something neater / better by doing something like this:&lt;BR /&gt;
&lt;BR /&gt;
Array Var{5} (0 0 0 0 0);&lt;BR /&gt;
or Array Var{5} (5*0); ??&lt;BR /&gt;
&lt;BR /&gt;
but this seems to make the array possess some sort of RETAIN feature which is not what I want.  Any ideas?</description>
      <pubDate>Thu, 30 Oct 2008 14:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58265#M6003</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-30T14:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning zero values to an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58266#M6004</link>
      <description>From on-line doc:&lt;BR /&gt;
"When any (or all) elements are assigned initial values, all elements behave as if they were named on a RETAIN statement."&lt;BR /&gt;
&lt;BR /&gt;
In this case, it would nice to say something like:&lt;BR /&gt;
&lt;BR /&gt;
var{*} = 0;&lt;BR /&gt;
&lt;BR /&gt;
but you can't. So I guess you are stuck with doing a do loop.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Thu, 30 Oct 2008 15:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58266#M6004</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-10-30T15:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning zero values to an array</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58267#M6005</link>
      <description>I have had some success with this using SET with the POINT= option.  &lt;BR /&gt;
&lt;BR /&gt;
This example is completely contrived but it may serve well enough to illustrate a way to initialize a list of variables without looping over all the elements of an array.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data initArray;&lt;BR /&gt;
   array v[5];&lt;BR /&gt;
   retain v 0;&lt;BR /&gt;
   run;&lt;BR /&gt;
data workWithArray;&lt;BR /&gt;
   array v[5];&lt;BR /&gt;
   do i = 1 to 6;&lt;BR /&gt;
      if i in(1,2,4) then set initArray point=point;&lt;BR /&gt;
      else do j = 1 to dim(v);&lt;BR /&gt;
         v&lt;J&gt; = ranuni(1);&lt;BR /&gt;
         end;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   retain point 1;&lt;BR /&gt;
   stop;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[pre]&lt;/J&gt;</description>
      <pubDate>Fri, 31 Oct 2008 19:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assigning-zero-values-to-an-array/m-p/58267#M6005</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2008-10-31T19:09:33Z</dc:date>
    </item>
  </channel>
</rss>

