<?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: DO LOOP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122934#M25230</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a short hand way to enter data when the design factors (A,B,Y) are fixed.&amp;nbsp; Only the value of F needs to be in the input data as the relative order determines what value of A,B,Y goes with the particular value of F.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Things that this program uses that beginners might not understand :&lt;/P&gt;&lt;P&gt;Use of trailing @@ on INPUT statement.&amp;nbsp; This is not strictly needed in the example program because all of the data is on one line so that a single at sign would also work.&amp;nbsp; But the double at sign allows you to split the data across rows when you have more than can fit on a single line of the input program.&amp;nbsp; For example in this program you can split the input data into two or more lines and get the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use of DO loop with a list of values.&amp;nbsp; In fact with a DO loop in SAS you can actually have in more complex list of values.&amp;nbsp; You can have :&lt;/P&gt;&lt;P&gt;do i=1 to 5,10,15 ;&lt;/P&gt;&lt;P&gt;And it will run the loop 7 times with I being set to 1,2,3,4,5,10,15 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use of the OUTPUT statement.&amp;nbsp; This will cause it to generate an observation in the output dataset.&amp;nbsp; So in this case one iteration of the data step will generate 2*2*2=8 output observations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 10 Nov 2012 00:51:06 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-11-10T00:51:06Z</dc:date>
    <item>
      <title>DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122931#M25227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I did not understand how to interpret this small program. Could someone help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;do A=0,1;&lt;/P&gt;&lt;P&gt;do B=0,1;&lt;/P&gt;&lt;P&gt;do Y=1,2;&lt;/P&gt;&lt;P&gt;input F @@;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;23 63 31 70 67 100 70 104&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp; Y&amp;nbsp;&amp;nbsp; F&lt;/P&gt;&lt;P&gt;0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 23&lt;/P&gt;&lt;P&gt;0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 63&lt;/P&gt;&lt;P&gt;0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 31&lt;/P&gt;&lt;P&gt;0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 70&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 67&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 104&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2012 22:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122931#M25227</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-09T22:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122932#M25228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is doing exactly what the program is telling it to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When&amp;nbsp; A=0 and B=0 and Y=1 it is inputting the first value (23)&lt;/P&gt;&lt;P&gt;it continues to read the same record because of the @@ included in the input statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then when A=0 and B=0 and Y=2 it reads the second record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then when A=0 and B=1 and Y=1 it reads the third record,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc., etc., etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Nov 2012 00:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122932#M25228</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-10T00:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122933#M25229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems to me like a cartesian Product.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Nov 2012 00:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122933#M25229</guid>
      <dc:creator>bnarang</dc:creator>
      <dc:date>2012-11-10T00:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122934#M25230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a short hand way to enter data when the design factors (A,B,Y) are fixed.&amp;nbsp; Only the value of F needs to be in the input data as the relative order determines what value of A,B,Y goes with the particular value of F.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Things that this program uses that beginners might not understand :&lt;/P&gt;&lt;P&gt;Use of trailing @@ on INPUT statement.&amp;nbsp; This is not strictly needed in the example program because all of the data is on one line so that a single at sign would also work.&amp;nbsp; But the double at sign allows you to split the data across rows when you have more than can fit on a single line of the input program.&amp;nbsp; For example in this program you can split the input data into two or more lines and get the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use of DO loop with a list of values.&amp;nbsp; In fact with a DO loop in SAS you can actually have in more complex list of values.&amp;nbsp; You can have :&lt;/P&gt;&lt;P&gt;do i=1 to 5,10,15 ;&lt;/P&gt;&lt;P&gt;And it will run the loop 7 times with I being set to 1,2,3,4,5,10,15 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use of the OUTPUT statement.&amp;nbsp; This will cause it to generate an observation in the output dataset.&amp;nbsp; So in this case one iteration of the data step will generate 2*2*2=8 output observations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Nov 2012 00:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122934#M25230</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-11-10T00:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122935#M25231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for the explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 13:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122935#M25231</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-12T13:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122936#M25232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for the details&amp;nbsp; to understand the topic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2012 13:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP/m-p/122936#M25232</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-11-12T13:58:07Z</dc:date>
    </item>
  </channel>
</rss>

