<?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 Array with Nested Loops in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-with-Nested-Loops/m-p/957482#M373774</link>
    <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please explain the below code as I am not able to understand the kind of output its giving.&lt;/P&gt;
&lt;P&gt;data temp;&lt;BR /&gt;format length width height 6.2;&lt;BR /&gt;array dimms lenght width height;&lt;BR /&gt;do j=1 to 10;&lt;BR /&gt;length = 100;&lt;BR /&gt;width = 50;&lt;BR /&gt;height = 30;&lt;BR /&gt;do i = 1 to 3;&lt;BR /&gt;dimms [i] = dimms[i] + normal (0)*2;&lt;BR /&gt;end;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;In the below output, why i am getting 2 "lenght" variable? What is the use of "normal (0)*2"?&lt;/P&gt;
&lt;P&gt;Why only first Lenght variable getting all 100s for all 10 observations however the other variables "width" and "height" are getting calculated values?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rahul_SAS_0-1738083394544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104079i57DE79CE18E15D56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rahul_SAS_0-1738083394544.png" alt="Rahul_SAS_0-1738083394544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2025 17:01:57 GMT</pubDate>
    <dc:creator>Rahul_SAS</dc:creator>
    <dc:date>2025-01-28T17:01:57Z</dc:date>
    <item>
      <title>Array with Nested Loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-Nested-Loops/m-p/957482#M373774</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please explain the below code as I am not able to understand the kind of output its giving.&lt;/P&gt;
&lt;P&gt;data temp;&lt;BR /&gt;format length width height 6.2;&lt;BR /&gt;array dimms lenght width height;&lt;BR /&gt;do j=1 to 10;&lt;BR /&gt;length = 100;&lt;BR /&gt;width = 50;&lt;BR /&gt;height = 30;&lt;BR /&gt;do i = 1 to 3;&lt;BR /&gt;dimms [i] = dimms[i] + normal (0)*2;&lt;BR /&gt;end;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;/P&gt;
&lt;P&gt;In the below output, why i am getting 2 "lenght" variable? What is the use of "normal (0)*2"?&lt;/P&gt;
&lt;P&gt;Why only first Lenght variable getting all 100s for all 10 observations however the other variables "width" and "height" are getting calculated values?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rahul_SAS_0-1738083394544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104079i57DE79CE18E15D56/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rahul_SAS_0-1738083394544.png" alt="Rahul_SAS_0-1738083394544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 17:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-Nested-Loops/m-p/957482#M373774</guid>
      <dc:creator>Rahul_SAS</dc:creator>
      <dc:date>2025-01-28T17:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Array with Nested Loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-Nested-Loops/m-p/957483#M373775</link>
      <description>&lt;P&gt;The variable named LENGHT is probably a mis-spelling of LENGTH, and this improperly spelled variable appears in your code. This mis-spelled variable has never been assigned a value so you see it is always missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NORMAL(0)*2 is a random number generator, multiplied by 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LENGTH always has a value of 100 because nowhere in the code does the value get changed, probably because of the mis-spelling that I mentioned.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 17:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-Nested-Loops/m-p/957483#M373775</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-28T17:20:48Z</dc:date>
    </item>
  </channel>
</rss>

