<?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: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170050#M264193</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please refer my reply to Mr.PGSTAT. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Feb 2014 01:53:51 GMT</pubDate>
    <dc:creator>JVarghese</dc:creator>
    <dc:date>2014-02-12T01:53:51Z</dc:date>
    <item>
      <title>Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170043#M264186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 22:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170043#M264186</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-10T22:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170044#M264187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;STOP statement CAN be used with SET POINT= Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data test;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do i = 1 to 10;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; set sashelp.class point=i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; if i = 5 then stop;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=test noobs; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dataset &lt;STRONG&gt;test&lt;/STRONG&gt; has 5 obs, not 10.&lt;/P&gt;&lt;P&gt;Please post the troublesome code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 23:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170044#M264187</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-10T23:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170045#M264188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Placing STOP within a conditional block will be a problem whenever conditions do NOT permit the block with STOP to execute&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 12:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170045#M264188</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-02-11T12:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170046#M264189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wouldn't use the stop statement but the MOD function with _n_ .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set sashelp.prdsale;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if mod(_n_ , 10) eq 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 15:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170046#M264189</guid>
      <dc:creator>Patrick_Tan</dc:creator>
      <dc:date>2014-02-11T15:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170047#M264190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The normal way that SAS stops a data step is when you read past the input when executing either a SET or INPUT statement.&lt;/P&gt;&lt;P&gt;If you are using point= option the SET statement will never read past the end of the data set. &lt;/P&gt;&lt;P&gt;So you need to manually tell it when to stop or else it will just continue to loop through the data step code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 15:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170047#M264190</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-02-11T15:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170048#M264191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry, I am not familiar with mod function yet. Thank you for giving the short cut.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Feb 2014 01:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170048#M264191</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-12T01:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170049#M264192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;data test;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;do i = 1 to 10 by 2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.class point=i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-family: inherit; font-size: 10pt; line-height: 1.5em; font-style: inherit;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-family: inherit; font-size: 10pt; line-height: 1.5em; font-style: inherit;"&gt;stop;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;can you tell me what happens to the dataset test with the above code and what if i put STOP right after OUTPUT there?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Feb 2014 01:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170049#M264192</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-12T01:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170050#M264193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please refer my reply to Mr.PGSTAT. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Feb 2014 01:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170050#M264193</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-12T01:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170051#M264194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Posting &lt;SPAN style="text-decoration: underline;"&gt;your code&lt;/SPAN&gt; will more likely get you pertinent answers. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Feb 2014 02:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170051#M264194</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-12T02:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170052#M264195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That code with read the 1st,3rd,5th,7th and 9th observation from SASHELP.CLASS and output them to TEST.&lt;/P&gt;&lt;P&gt;If you move the STOP to after the OUTPUT then it will stop after doing that for just the first observation. So you get just one observation.&lt;/P&gt;&lt;P&gt;If you let your point variable range past the end of the input dataset then it will continue to output the last record that it successfully read.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Feb 2014 03:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170052#M264195</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-02-12T03:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170053#M264196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when a SET statement is put inside a do loop, Would SET loose its default behaviour ? or is it only controlled by the do loop, for writing the output? And I was just wondering, why even after reaching the end of the input dataset it should loop again continuously if we skip the STOP statement.. Is this also for the same reason that the SET statement was inside do loop for it blocked the communication b/w DATA and SET statements.? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 23:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170053#M264196</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-14T23:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170054#M264197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Placing it inside of a DO loop does NOT change how a SET statement works, but it will make a big difference in how the implicit OUTPUT at the end of the data step works.&amp;nbsp; For example try this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data even ;&lt;/P&gt;&lt;P&gt;do i=1 to 2; set sashelp.class; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To see better how it is that a normal simple data step works put in some PUT statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'Before ' _n_= ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'After ' _n_ = ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that the data step dies before the second PUT statement on the 20th loop because the SET statement tried to read past the end of the input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 23:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170054#M264197</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-02-14T23:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170055#M264198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please run this code;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'Before ' _n_= ;&lt;/P&gt;&lt;P&gt;do i=1 to 19 by 2;&lt;/P&gt;&lt;P&gt;put 'Before ' _n_= ;&lt;/P&gt;&lt;P&gt;set sashelp.class point=i;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'After ' _n_ = ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question: As long as the SET statement is within do loop iterations, the data step is being controlled by DO ? Coz, I couldn,t see the _N_ value getting added up...but at the same time the expected dataset was created successfully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Feb 2014 00:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170055#M264198</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-15T00:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170056#M264199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The value the automatic variable _N_ has nothing to do with the SET statement.&lt;/P&gt;&lt;P&gt;It can never be larger than 1 in your example because the data step code will never execute more than once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Feb 2014 00:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170056#M264199</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-02-15T00:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why STOP statement cannot be put inside an iterative do loop when used with a POINT= option in SET statement? Ex: While reading every 10th obs to a new data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170057#M264200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats right. I got it. Thank you very much for your time writing for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Feb 2014 21:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-STOP-statement-cannot-be-put-inside-an-iterative-do-loop/m-p/170057#M264200</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-02-15T21:39:02Z</dc:date>
    </item>
  </channel>
</rss>

