<?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... when are they better than just a do loop? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461166#M117271</link>
    <description>&lt;P&gt;ARRAYs are usually useful when you want to perform the same (or very similar) analysis on many different columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do loops not in an array are much more general, and allow you to iterate until some (hopefully) desirable result is obtained.&lt;/P&gt;</description>
    <pubDate>Wed, 09 May 2018 19:07:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-05-09T19:07:44Z</dc:date>
    <item>
      <title>Arrays... when are they better than just a do loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461160#M117269</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there any resources regarding when to do a do loop with an array, as opposed to just a do loop without an array? What are the advantages of using an array, and when use them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 18:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461160#M117269</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-05-09T18:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays... when are they better than just a do loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461166#M117271</link>
      <description>&lt;P&gt;ARRAYs are usually useful when you want to perform the same (or very similar) analysis on many different columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do loops not in an array are much more general, and allow you to iterate until some (hopefully) desirable result is obtained.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 19:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461166#M117271</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-05-09T19:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays... when are they better than just a do loop?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461202#M117284</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have one other related question: the _n_ = 1 for arrays. Does that mean it starts at the first observation, first line. etc? I see that written and I am not entirely sure what it does. See the code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data score ; 
	array ans{10} $1 ; 
	array key{10} $1 _temporary_  ; 
*Load the temporary array elements*
	If _n_ = 1 then do Ques = 1 to 10 ; *_n_ = 1 only does first line of the key *
I		input key{Ques} $1. @ ; 
	end ; 
	
	Input ID (Ans1-Ans10) ($1.) ;
	Rawscore = 0 ; 
	
*Score the Test*
	do Ques = 1 to 10 ; 
		Rawscore + (key(Ques) eq Ans(Ques)) ; 
	end ; 
Percent = 100*Rawscore ; 
keep ID Rawscore Percent ; 
Datalines ; &lt;/PRE&gt;</description>
      <pubDate>Wed, 09 May 2018 21:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays-when-are-they-better-than-just-a-do-loop/m-p/461202#M117284</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-05-09T21:08:49Z</dc:date>
    </item>
  </channel>
</rss>

