<?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: Finding Data errors  with _error_ in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-Data-errors-with-error/m-p/303508#M64488</link>
    <description>&lt;P&gt;You will want to read this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://v8doc.sas.com/sashtml/lrcon/z0695104.htm" target="_blank"&gt;https://v8doc.sas.com/sashtml/lrcon/z0695104.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically as the datastep runs its loop, it goes line by line into the PDV, _error_ is a variable in that PDV which does not get written to the output dataset. &amp;nbsp;So after the first run; that variable no longer exists. &amp;nbsp;It is created again in the second step, but as there are no errors then the _error_ variable is always false, hence no observations. &amp;nbsp;This will work as the if _error_ is in the same step:&lt;/P&gt;
&lt;PRE&gt;data bad good;
  input ID Name$;
  if _error_ then output bad;
  else output good;
datalines;
121 Kiran
768 Kumar
tyu Raj
;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2016 08:16:48 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-10-10T08:16:48Z</dc:date>
    <item>
      <title>Finding Data errors  with _error_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Data-errors-with-error/m-p/303507#M64487</link>
      <description>&lt;P&gt;In the below example,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input ID Name$;
datalines;
121 Kiran
768 Kumar
tyu Raj
;
run;

data good bad;
set test;
if _error_=1 then output bad;
else output good	;
run;

proc print data=bad;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The dataset 'bad' is showing 0 observations, however i expect it to list the last observation from dataset, as there is a data error (_error_=1); Could some one please explain&amp;nbsp;why it is&amp;nbsp;not showing up.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 08:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Data-errors-with-error/m-p/303507#M64487</guid>
      <dc:creator>Rafi</dc:creator>
      <dc:date>2016-10-10T08:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Data errors  with _error_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Data-errors-with-error/m-p/303508#M64488</link>
      <description>&lt;P&gt;You will want to read this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://v8doc.sas.com/sashtml/lrcon/z0695104.htm" target="_blank"&gt;https://v8doc.sas.com/sashtml/lrcon/z0695104.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically as the datastep runs its loop, it goes line by line into the PDV, _error_ is a variable in that PDV which does not get written to the output dataset. &amp;nbsp;So after the first run; that variable no longer exists. &amp;nbsp;It is created again in the second step, but as there are no errors then the _error_ variable is always false, hence no observations. &amp;nbsp;This will work as the if _error_ is in the same step:&lt;/P&gt;
&lt;PRE&gt;data bad good;
  input ID Name$;
  if _error_ then output bad;
  else output good;
datalines;
121 Kiran
768 Kumar
tyu Raj
;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 08:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Data-errors-with-error/m-p/303508#M64488</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-10T08:16:48Z</dc:date>
    </item>
  </channel>
</rss>

