<?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: PROC DS2 and _error_ in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DS2-and-error/m-p/349402#M63750</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The _ERROR_ is an automatic variable within the DATA Step. You do not have the same variable available in DS2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the doc:&lt;/P&gt;
&lt;P&gt;Automatic Variables&lt;/P&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-topic"&gt;
&lt;DIV class="xis-topicContent"&gt;
&lt;DIV id="n0kphp4duf0dnnn1mnpam714vl1c" class="xis-paragraph"&gt;
&lt;DIV class="xis-listTermDef"&gt;
&lt;DIV id="n19witj9ls8xq5n1e3ts2tnz5xht" class="xis-termDefPair"&gt;
&lt;DIV class="xis-term"&gt;_ERROR_&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;is 0 by default but is set to 1 whenever an error is encountered, such as an input data error, a conversion error, or a math error, as in division by 0 or a floating point overflow.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;I assume there is some data type conversion, this triggered the _ERROR_ to be set to 1, whereas this does not happen in DS2.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;Bruno&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 12 Apr 2017 12:15:29 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2017-04-12T12:15:29Z</dc:date>
    <item>
      <title>PROC DS2 and _error_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DS2-and-error/m-p/349343#M63749</link>
      <description>&lt;P&gt;I have started using DS2 programming and have hit a snag.&amp;nbsp; I have tried to convert a data step into DS2, however I am not 100 % sure that the procedure is handling the _error_ :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc ds2;&lt;BR /&gt;data spdework.dsn1 (overwrite=yes) spdework.dsn2 (overwrite=yes);&lt;BR /&gt;&amp;nbsp; dcl char brand country ;&lt;BR /&gt;&amp;nbsp; dcl double _error_&amp;nbsp;;&lt;BR /&gt;&amp;nbsp; method init();&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; method run();&lt;BR /&gt;&amp;nbsp;SET spdework.aami_rif_1 (rename=( nvar_pre=nvar));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;IF gdp&amp;gt;0 and content&amp;gt;0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;country='US';&lt;BR /&gt;&amp;nbsp;else if gdp&amp;gt;0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;country='UK';&lt;BR /&gt;&amp;nbsp;else if content&amp;gt;0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;country='EU';&lt;BR /&gt;&amp;nbsp;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;PUT 'errors';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if nvar&amp;gt;0 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;nvar=1;&lt;BR /&gt;&amp;nbsp;brand='Brand X&amp;nbsp; ';&lt;BR /&gt;&amp;nbsp;set {select distinct customer from spdework.dsn3}; &lt;BR /&gt;&amp;nbsp;if _error_ then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;output spdework.dsn1;&lt;BR /&gt;&amp;nbsp;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;output spdework.dsn2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; method term();&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;enddata;&lt;BR /&gt;run; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In data step I was getting 606490 in DS2 112810 obs.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 08:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DS2-and-error/m-p/349343#M63749</guid>
      <dc:creator>gra_in_aus</dc:creator>
      <dc:date>2017-04-12T08:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DS2 and _error_</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DS2-and-error/m-p/349402#M63750</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The _ERROR_ is an automatic variable within the DATA Step. You do not have the same variable available in DS2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the doc:&lt;/P&gt;
&lt;P&gt;Automatic Variables&lt;/P&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-topic"&gt;
&lt;DIV class="xis-topicContent"&gt;
&lt;DIV id="n0kphp4duf0dnnn1mnpam714vl1c" class="xis-paragraph"&gt;
&lt;DIV class="xis-listTermDef"&gt;
&lt;DIV id="n19witj9ls8xq5n1e3ts2tnz5xht" class="xis-termDefPair"&gt;
&lt;DIV class="xis-term"&gt;_ERROR_&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;is 0 by default but is set to 1 whenever an error is encountered, such as an input data error, a conversion error, or a math error, as in division by 0 or a floating point overflow.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;I assume there is some data type conversion, this triggered the _ERROR_ to be set to 1, whereas this does not happen in DS2.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;Bruno&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DS2-and-error/m-p/349402#M63750</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-04-12T12:15:29Z</dc:date>
    </item>
  </channel>
</rss>

