<?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: explicit OUTPUT statement in DO loop while using SET statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295686#M61822</link>
    <description>&lt;P&gt;thanks for your reply&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;, sorry for my mistake. the result is the same as you have mentioned.&lt;/P&gt;&lt;P&gt;Thanks for your explanation .&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2016 03:58:03 GMT</pubDate>
    <dc:creator>monusing</dc:creator>
    <dc:date>2016-09-01T03:58:03Z</dc:date>
    <item>
      <title>explicit OUTPUT statement in DO loop while using SET statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295620#M61798</link>
      <description>&lt;P&gt;Please clear my confusion on the below explained scenario&lt;/P&gt;&lt;P&gt;I have a dataset salary with below observations&amp;nbsp;&lt;/P&gt;&lt;P&gt;obs &amp;nbsp; &amp;nbsp; salary&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12245&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34500&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 44000&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34435&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i ran the below code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tt;
do until(totalsal ge 50000);
set  salary;
totalsal + salary;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and i get result as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;obs &amp;nbsp; &amp;nbsp; &amp;nbsp;salary &amp;nbsp; totalsal&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456 &amp;nbsp;23456&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12245 &amp;nbsp;35701&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34500 &amp;nbsp;70201&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when i ran the below code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tt;
do until(totalsal ge 50000);
set  salary;
totalsal + salary;
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and i get result as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;obs &amp;nbsp; &amp;nbsp; &amp;nbsp;salary &amp;nbsp; totalsal&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456 &amp;nbsp;23456&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12245 &amp;nbsp;35701&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34500 &amp;nbsp;70201&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 44000 &amp;nbsp;114201&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 34435 &amp;nbsp;148636&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please explain why is there a difference in the output, as i have already put the condition to continue the process only till&lt;/P&gt;&lt;P&gt;the "TOTALSAL" reaches 50000 or more?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 18:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295620#M61798</guid>
      <dc:creator>monusing</dc:creator>
      <dc:date>2016-08-31T18:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: explicit OUTPUT statement in DO loop while using SET statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295636#M61802</link>
      <description>&lt;P&gt;Actually, you have asked a complex question.&amp;nbsp; Here's a program you can test to start moving in the right direction.&amp;nbsp; How does this DATA step end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tt;&lt;/P&gt;
&lt;P&gt;put 'Next, SAS will execute the SET statement.';&lt;/P&gt;
&lt;P&gt;set salary;&lt;/P&gt;
&lt;P&gt;totalsal + salary;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Important clue:&amp;nbsp; How many messages does the PUT statement write?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 19:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295636#M61802</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-31T19:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: explicit OUTPUT statement in DO loop while using SET statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295683#M61820</link>
      <description>&lt;P&gt;The result from the first version of the code actually is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;obs salary totalsal&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1 34500 70201&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2 44000 114201&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;3 34435 148636&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When a data step doesn't include an explicit OUTPUT statement, SAS inserts one right before the RUN statement. Thus, in your first version of the code, the OUTPUT is situated outside the DO UNTIL() loop. It will run after the UNTIL condition is met. In the second version of the code, the OUTPUT occurs explicitly within each iteration of the loop, whether the UNTIL condition is met or not.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 03:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295683#M61820</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-09-01T03:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: explicit OUTPUT statement in DO loop while using SET statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295686#M61822</link>
      <description>&lt;P&gt;thanks for your reply&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;, sorry for my mistake. the result is the same as you have mentioned.&lt;/P&gt;&lt;P&gt;Thanks for your explanation .&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 03:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/explicit-OUTPUT-statement-in-DO-loop-while-using-SET-statement/m-p/295686#M61822</guid>
      <dc:creator>monusing</dc:creator>
      <dc:date>2016-09-01T03:58:03Z</dc:date>
    </item>
  </channel>
</rss>

