<?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: Array problem in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22056#M4763</link>
    <description>This fixes a few of the problems.&lt;BR /&gt;
&lt;BR /&gt;
DATA sample;&lt;BR /&gt;
 m = 1;&lt;BR /&gt;
array All {10,10}; /*two dimensional arrays 10 x 10 */&lt;BR /&gt;
i=1;&lt;BR /&gt;
do k= 1 to 10; /*start do loop to read 10 times*/&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
all(i,k)=0;&lt;BR /&gt;
choose=int(ranuni(58)*m)+1; /*generate 10 random observations out of data*/&lt;BR /&gt;
put choose =;&lt;BR /&gt;
set work.data point=choose nobs=m ;&lt;BR /&gt;
&lt;BR /&gt;
all(i,k)= numbers;&lt;BR /&gt;
 put numbers=  i =  k=;&lt;BR /&gt;
end;&lt;BR /&gt;
end;&lt;BR /&gt;
do j = 1 to 10;&lt;BR /&gt;
average=mean(of all(j,1), all(j,2),all(j,3),all(j,4),&lt;BR /&gt;
all(j,5),all(j,6),all(j,7),all(j,8),all(j,9), all(j,10));&lt;BR /&gt;
put average=;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
stop;&lt;BR /&gt;
*drop i k;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 25 Nov 2009 19:17:58 GMT</pubDate>
    <dc:creator>Flip</dc:creator>
    <dc:date>2009-11-25T19:17:58Z</dc:date>
    <item>
      <title>Array problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22054#M4761</link>
      <description>I have a data set that has 1 variable (numbers) and 100 observations(100 rows)&lt;BR /&gt;
I want to randomly pick 10 variables out of the hundred with replacement&lt;BR /&gt;
put them in an array &lt;BR /&gt;
now I want to do it again 10 times and put them in the dataset with array 1-10&lt;BR /&gt;
&lt;BR /&gt;
then I want to calculate the mean for the 10 columns in the array.&lt;BR /&gt;
I don't get errors when I run my code, but I also don't get any observations&lt;BR /&gt;
Any help would be greatly appreciated. THANKS!&lt;BR /&gt;
&lt;BR /&gt;
Here is my code:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 DATA sample;&lt;BR /&gt;
 array All {10,10};                           /*two dimensional arrays 10 x 10 */&lt;BR /&gt;
do k= 1 to 10;                               /*start do loop to read 10 times*/&lt;BR /&gt;
all(i,k)=0;&lt;BR /&gt;
&lt;BR /&gt;
    choose=int(ranuni(58)*m)+1;      /*generate 10 random observations out of data*/&lt;BR /&gt;
    set work.data point=choose nobs=m;&lt;BR /&gt;
    i+1;&lt;BR /&gt;
    if i &amp;gt; 10 then stop;&lt;BR /&gt;
	&lt;BR /&gt;
	all(i,k)= numbers;&lt;BR /&gt;
	&lt;BR /&gt;
end;&lt;BR /&gt;
average=mean(of k1-k10);&lt;BR /&gt;
drop i k;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 25 Nov 2009 17:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22054#M4761</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-11-25T17:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Array problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22055#M4762</link>
      <description>You have a STOP statement inside your DO / END loop, which prematurely stops the DATA step execution before the DATA step gets to the MEAN calculation.  You must determine where to execute an explicit OUTPUT for your purposes and when (how many times).&lt;BR /&gt;
&lt;BR /&gt;
Suggest you enhance your program debugging capabilities by using the line below liberally in various locations to learn what SAS is performing (substituting DIAGn for DIAG1 with each location where you add the line):&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG '&amp;gt;DIAG1&amp;gt;' / _ALL;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: Concepts, DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm&lt;/A&gt;</description>
      <pubDate>Wed, 25 Nov 2009 17:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22055#M4762</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-11-25T17:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Array problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22056#M4763</link>
      <description>This fixes a few of the problems.&lt;BR /&gt;
&lt;BR /&gt;
DATA sample;&lt;BR /&gt;
 m = 1;&lt;BR /&gt;
array All {10,10}; /*two dimensional arrays 10 x 10 */&lt;BR /&gt;
i=1;&lt;BR /&gt;
do k= 1 to 10; /*start do loop to read 10 times*/&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
all(i,k)=0;&lt;BR /&gt;
choose=int(ranuni(58)*m)+1; /*generate 10 random observations out of data*/&lt;BR /&gt;
put choose =;&lt;BR /&gt;
set work.data point=choose nobs=m ;&lt;BR /&gt;
&lt;BR /&gt;
all(i,k)= numbers;&lt;BR /&gt;
 put numbers=  i =  k=;&lt;BR /&gt;
end;&lt;BR /&gt;
end;&lt;BR /&gt;
do j = 1 to 10;&lt;BR /&gt;
average=mean(of all(j,1), all(j,2),all(j,3),all(j,4),&lt;BR /&gt;
all(j,5),all(j,6),all(j,7),all(j,8),all(j,9), all(j,10));&lt;BR /&gt;
put average=;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
stop;&lt;BR /&gt;
*drop i k;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 25 Nov 2009 19:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-problem/m-p/22056#M4763</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-11-25T19:17:58Z</dc:date>
    </item>
  </channel>
</rss>

