<?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 Logic of this o/p in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Logic-of-this-o-p/m-p/208535#M51687</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, can you explain how this o/p is obtained when the following program is executed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abc;&lt;/P&gt;&lt;P&gt;input a $ b;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;A 20&lt;/P&gt;&lt;P&gt;B 40&lt;/P&gt;&lt;P&gt;C 60&lt;/P&gt;&lt;P&gt;D 80&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;data xyz;&lt;/P&gt;&lt;P&gt;do i = 1 to 3;&lt;/P&gt;&lt;P&gt;set abc;&lt;/P&gt;&lt;P&gt;X + 1;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=xyz; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please also throw some light at what point Set statement is read&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 May 2015 02:29:40 GMT</pubDate>
    <dc:creator>abhishekbhatia02</dc:creator>
    <dc:date>2015-05-04T02:29:40Z</dc:date>
    <item>
      <title>Logic of this o/p</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-of-this-o-p/m-p/208535#M51687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, can you explain how this o/p is obtained when the following program is executed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data abc;&lt;/P&gt;&lt;P&gt;input a $ b;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;A 20&lt;/P&gt;&lt;P&gt;B 40&lt;/P&gt;&lt;P&gt;C 60&lt;/P&gt;&lt;P&gt;D 80&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;data xyz;&lt;/P&gt;&lt;P&gt;do i = 1 to 3;&lt;/P&gt;&lt;P&gt;set abc;&lt;/P&gt;&lt;P&gt;X + 1;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=xyz; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please also throw some light at what point Set statement is read&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 02:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-of-this-o-p/m-p/208535#M51687</guid>
      <dc:creator>abhishekbhatia02</dc:creator>
      <dc:date>2015-05-04T02:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Logic of this o/p</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Logic-of-this-o-p/m-p/208536#M51688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Execute this data step, which sheds some light of the execution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data xyz;&lt;/P&gt;&lt;P&gt;do i = 1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;putlog 'BEFORE' _ALL_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set abc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;putlog 'AFTER ' _ALL_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First the inner loop is executed 3 times, and 3 rows from abc dataset are read into the PDV, and than output. This is only the first data step cycle (_N_=1). (&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Remember: data step always constructs a loop if you use a set,merge,infile,update,modify statement.&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;Then comes the second &lt;STRONG&gt;cycle of the data step&lt;/STRONG&gt; (_N_=2).&lt;/P&gt;&lt;P&gt;The inner loop starts 2 times: First it is executed completely, but in the second iteration there comes the &lt;STRONG&gt;set&lt;/STRONG&gt; statement. And &lt;STRONG&gt;this is the moment, when the data step finishes (exits, stops), because there are no more observations&lt;/STRONG&gt; in abc dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 13:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Logic-of-this-o-p/m-p/208536#M51688</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2015-05-04T13:37:13Z</dc:date>
    </item>
  </channel>
</rss>

