<?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 Getting elements from a vector in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66214#M14375</link>
    <description>I have a column of numbers&lt;BR /&gt;
2&lt;BR /&gt;
3&lt;BR /&gt;
5&lt;BR /&gt;
6&lt;BR /&gt;
7&lt;BR /&gt;
12&lt;BR /&gt;
11&lt;BR /&gt;
9&lt;BR /&gt;
and I want to use them one by one in a do loop. How should I express the dimensions of that array to make the loop read the element of the first row, then the second row, etc...</description>
    <pubDate>Sun, 22 Aug 2010 04:55:37 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-08-22T04:55:37Z</dc:date>
    <item>
      <title>Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66214#M14375</link>
      <description>I have a column of numbers&lt;BR /&gt;
2&lt;BR /&gt;
3&lt;BR /&gt;
5&lt;BR /&gt;
6&lt;BR /&gt;
7&lt;BR /&gt;
12&lt;BR /&gt;
11&lt;BR /&gt;
9&lt;BR /&gt;
and I want to use them one by one in a do loop. How should I express the dimensions of that array to make the loop read the element of the first row, then the second row, etc...</description>
      <pubDate>Sun, 22 Aug 2010 04:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66214#M14375</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-22T04:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66215#M14376</link>
      <description>We are almost certainly going to need more information before we can get you a fully satisfactory answer.&lt;BR /&gt;
&lt;BR /&gt;
The DATA step has an implied loop that processes each row of a table one row at a time.  &lt;BR /&gt;
[pre]&lt;BR /&gt;
data new;&lt;BR /&gt;
  set old;&lt;BR /&gt;
   ......each value is processed one at a time ......&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sun, 22 Aug 2010 05:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66215#M14376</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-08-22T05:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66216#M14377</link>
      <description>Using a DATA step, you can load the input data and also use an ARRAY declaration to reference the variable list in a DO I=1 TO DIM(&lt;ARRAYNAME&gt;);  END;  code paragraph.  The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website had SAS-hosted DOC and supplemental technical and conference reference material on the topic.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
intro data step programming array site:sas.com&lt;/ARRAYNAME&gt;</description>
      <pubDate>Sun, 22 Aug 2010 13:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66216#M14377</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-22T13:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66217#M14378</link>
      <description>This is what I'm trying to do...&lt;BR /&gt;
&lt;BR /&gt;
data z.A9 z.B9;&lt;BR /&gt;
set grades1;&lt;BR /&gt;
/*This is the data set that contains the array "yr" which is a two dimensional array, rows(24) by columns(6)*/&lt;BR /&gt;
array yr(6) yr1-yr6;&lt;BR /&gt;
array f(6);&lt;BR /&gt;
do n = 1 to 6;&lt;BR /&gt;
&lt;BR /&gt;
f(n) = quantile('BINOM',yr(n),.5,10);&lt;BR /&gt;
&lt;BR /&gt;
end;&lt;BR /&gt;
/* Now in the following loop I want to use the numbers from the first column of the array f*/&lt;BR /&gt;
/*I don't know how to express the dimensions of the array f in order to use the elements in each row of the array*/&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    do i=1 to 24;    &lt;BR /&gt;
	    &lt;BR /&gt;
	   x3=0;         &lt;BR /&gt;
	   do j=1 to f(1,i,1)???;      &lt;BR /&gt;
	      x2=7000+exp(5.12+0.92*rannor(123));      &lt;BR /&gt;
	      x3=x3+x2;      &lt;BR /&gt;
	            &lt;BR /&gt;
	      output z.A9;                 &lt;BR /&gt;
	      ** output to B only when J=f(1,i,1) in the inner loop;&lt;BR /&gt;
	      if j=f(1,i,1) then x4=x4+x3; &lt;BR /&gt;
	      if j=f(1,i,1) then output z.B9;    &lt;BR /&gt;
	    end;&lt;BR /&gt;
&lt;BR /&gt;
	   output z.A9;&lt;BR /&gt;
&lt;BR /&gt;
	   &lt;BR /&gt;
	end;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 23 Aug 2010 14:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66217#M14378</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-23T14:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66218#M14379</link>
      <description>The SAS Support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted DOC and supplemental technical / conference reference material on this topic/post.  Here's one example using the site's SEARCH facility:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#/documentation/cdl/en/lrcon/62955/HTML/default/a000739621.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#/documentation/cdl/en/lrcon/62955/HTML/default/a000739621.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
dimensional array site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
introduction array site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
dim function site:sas.com</description>
      <pubDate>Mon, 23 Aug 2010 14:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66218#M14379</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-23T14:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elements from a vector</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66219#M14380</link>
      <description>Hi:&lt;BR /&gt;
  There is some good background on arrays in this paper and, in addition, example 4 and example 5 in this paper show examples of multi-dimensional array usage:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf" target="_blank"&gt;http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 23 Aug 2010 16:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Getting-elements-from-a-vector/m-p/66219#M14380</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-08-23T16:04:12Z</dc:date>
    </item>
  </channel>
</rss>

