<?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: Keep statement and creation of variables in same program leads to misread data--what went wrong? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292951#M311782</link>
    <description>&lt;P&gt;Indeed! Most errors are reflected in one way or another in the log. Don't hesitate to consult again if you see anything suspicious.&lt;/P&gt;</description>
    <pubDate>Sun, 21 Aug 2016 02:15:15 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-08-21T02:15:15Z</dc:date>
    <item>
      <title>Keep statement and creation of variables in same program leads to misread data--what went wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292947#M311779</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My grad student wrote a SAS program where he kept a small number of variables from a larger dataset and in the same program created some new variables from the ones he kept.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;He noticed that the log reported operations performed on missing data when he knew he had none.&amp;nbsp; To our dismay, we discovered that the newly created variables and renamed variables were moved to the next line of data so that the new variables were now paired with a different id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I ran the keep statement in a separate program from the steps that created the new variables, this did not happen (see both programs, log, and output in attached document).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What went wrong?&amp;nbsp; The potential for this type of error to wreak havoc on a dataset worries me, so I am very anxious to understand it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Version is SAS 9.4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks to anyone who can provide insights.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2016 01:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292947#M311779</guid>
      <dc:creator>acschul3</dc:creator>
      <dc:date>2016-08-21T01:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Keep statement and creation of variables in same program leads to misread data--what went wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292949#M311780</link>
      <description>&lt;P&gt;Lines 338-341: Calculated values are missing because the data is read AFTER the calculations are done. Move the set statement before math operations.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2016 02:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292949#M311780</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-08-21T02:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Keep statement and creation of variables in same program leads to misread data--what went wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292950#M311781</link>
      <description>&lt;P&gt;Many thanks for the quick reply.&amp;nbsp; A simple error that has great potential for creating problems.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2016 02:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292950#M311781</guid>
      <dc:creator>acschul3</dc:creator>
      <dc:date>2016-08-21T02:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Keep statement and creation of variables in same program leads to misread data--what went wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292951#M311782</link>
      <description>&lt;P&gt;Indeed! Most errors are reflected in one way or another in the log. Don't hesitate to consult again if you see anything suspicious.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2016 02:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-statement-and-creation-of-variables-in-same-program-leads/m-p/292951#M311782</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-08-21T02:15:15Z</dc:date>
    </item>
  </channel>
</rss>

