<?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: Arrays which do not produce in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781982#M31853</link>
    <description>&lt;P&gt;This statement is suspect:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do J = numsdrawn(I+1) to 5 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It tells SAS to use one of your variable values (num1 through num5) to indicate the starting point for the array.&amp;nbsp; More likely, you meant:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do J = I+1 to 5 ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Nov 2021 15:49:49 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2021-11-23T15:49:49Z</dc:date>
    <item>
      <title>Arrays which do not produce</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781963#M31851</link>
      <description>&lt;P&gt;Second_step is take data and&amp;nbsp; produce about 10 lines of output per 1 line read in. It does not.&lt;/P&gt;&lt;P&gt;Why is this code not producing results?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Data Second_step (keep =drawdate pbnum num1of2 num2of2);&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;Set First_step(keep= Drawdate num1 num2 num3 num4 num5 pbnum multinum obs=2) ;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;array numsdrawn {6} num1 num2 num3 num4 num5 multinum;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;length num1of2 num2of2 8;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;do I=1 to 4;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;num1of2 = numsdrawn(I) ;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;put &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/145066"&gt;@10&lt;/a&gt; 'NUM1of2 =' num1of2 2. @;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;do J = numsdrawn(I+1) to 5 ;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;num2of2 = numsdrawn(j);&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;put &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54795"&gt;@25&lt;/a&gt; 'num2of2=' @35 num2of2 2. @40 "J=" +2 J 2.;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;output;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;end;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;end;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;Run;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Nov 2021 14:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781963#M31851</guid>
      <dc:creator>thenycguy</dc:creator>
      <dc:date>2021-11-23T14:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays which do not produce</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781974#M31852</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Second_step (keep=drawdate pbnum num1of2 num2of2);
set First_step (keep=Drawdate num1 num2 num3 num4 num5 pbnum multinum obs=2);
array numsdrawn {6} num1 num2 num3 num4 num5 multinum;
length num1of2 num2of2 8;
do I = 1 to 4;
  num1of2 = numsdrawn(I) ;
  put @10 'NUM1of2 =' num1of2 2. @; /* PUT writes to the log */
  do J = numsdrawn(I+1) to 5 ;
    num2of2 = numsdrawn(j);
    put @25 'num2of2=' @35 num2of2 2. @40 "J=" +2 J 2.; /* to the log */
    output; /* OUTPUT writes to the dataset named in the DATA statement */
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A data step will not create output for the Output window/tab. Your data step PUTs some information to the log, and will write 40 observations (2 obs read, two DO loops 4 by 5 = 20) to the resulting dataset.&lt;/P&gt;
&lt;P&gt;Either use an output producing procedure (e.g.PRINT), or redirect the output with a FILE PRINT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 15:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781974#M31852</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-23T15:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays which do not produce</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781982#M31853</link>
      <description>&lt;P&gt;This statement is suspect:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do J = numsdrawn(I+1) to 5 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It tells SAS to use one of your variable values (num1 through num5) to indicate the starting point for the array.&amp;nbsp; More likely, you meant:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do J = I+1 to 5 ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Nov 2021 15:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781982#M31853</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-11-23T15:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays which do not produce</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781998#M31854</link>
      <description>&lt;P&gt;So you want to produce pairs of numbers from a list?&amp;nbsp; You second DO loops index variable is using the wrong starting value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data second_step;
  set first_step;
  array numsdrawn num1-num5 ;
  do i=1 to dim(numsdrawn)-1;
    do j = i+1 to dim(numsdrawn) ;
      num1of2 = numsdrawn[i] ;
      num2of2 = numsdrawn[j];
      output;
    end;
  end;
  drop i j ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Nov 2021 16:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Arrays-which-do-not-produce/m-p/781998#M31854</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-23T16:45:32Z</dc:date>
    </item>
  </channel>
</rss>

