<?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: ERROR: The COALESCE function requires its arguments to be of the same data type. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267643#M52914</link>
    <description>&lt;P&gt;The two dates may both be date-type, but the PUT function always returns a character string.&amp;nbsp; Luckily, you can change that pretty easily by getting rid of the PUT function and just using the numeric part of that term (in two places):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;today()&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2016 15:26:44 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-05-02T15:26:44Z</dc:date>
    <item>
      <title>ERROR: The COALESCE function requires its arguments to be of the same data type.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267636#M52912</link>
      <description>&lt;P&gt;Hi. I'm having trouble understanding the issue here. &amp;nbsp;Both A.Actual_Dlvry_Date and B.&lt;SPAN&gt;Actual_Dlvry_Date come from Oracle database tables where they are defined as DATE types. I'm just trying to compare them to see if they mismatch and handle the circumstance where one or both are missing values. &amp;nbsp;I don't see where I'm being inconsistant with the data types.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Libref IV_ORA was successfully assigned as follows:&lt;BR /&gt; Engine: ORACLE&lt;BR /&gt; Physical Name: IVASPRD&lt;BR /&gt;1 libname iv_ora oracle user=&amp;amp;orauser pass=&amp;amp;orapass path="IVASPRD" schema="IVPRL" UPDATE_LOCK_TYPE=row;&lt;BR /&gt;NOTE: Libref BIDS_ORA was successfully assigned as follows:&lt;BR /&gt; Engine: ORACLE&lt;BR /&gt; Physical Name: IBSCRPRD&lt;BR /&gt;2 libname bids_ora oracle user=exfcread pass=XXXXXXXXXXXXXXXXXX path="IBSCRPRD" schema="IMAPSSCR" UPDATE_LOCK_TYPE=row;&lt;BR /&gt;&lt;BR /&gt;9   + proc sql;
9   +                   create table QueryData as         (       select 'ACTUAL DELIVERY DATE MISMATCH' as RULE_NM,
      b.actual_dlvry_date as AD_DT,                 b.imb_code,                 2 as rule_order                 from
10  + iv_ora.bi_spm_piece_recon a,  bids_ora.bi_spm_piece_recon b                 where a.imb_code = b.imb_code
 and COALESCE(A.ACTUAL_DLVRY_DATE,PUT(today(), yymmddn8.)) &amp;lt;&amp;gt; COALESCE(B.ACTUAL_DLVRY_DATE,PUT(today(), yymmddn8.))         );
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "not equals".
ERROR: The COALESCE function requires its arguments to be of the same data type.
ERROR: The COALESCE function requires its arguments to be of the same data type.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
11  +  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 15:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267636#M52912</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-02T15:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The COALESCE function requires its arguments to be of the same data type.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267643#M52914</link>
      <description>&lt;P&gt;The two dates may both be date-type, but the PUT function always returns a character string.&amp;nbsp; Luckily, you can change that pretty easily by getting rid of the PUT function and just using the numeric part of that term (in two places):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;today()&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 15:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267643#M52914</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-02T15:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The COALESCE function requires its arguments to be of the same data type.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267647#M52915</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The put(...) function converts your today() date value to a text string, hence it's a different type to the Oracle date value which SAS will provide as a SAS datetime value which is numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coalesce is a string function so requires both arguments to be text, hence you'll need to convert your Oracle date too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A factor you might also consider is that Oracle only has a single data type DATE which is actually date-time - a date in Oracle simply has zero hours, minutes and seconds - so you might need to do a bit more transformation before comparing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Steve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 15:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267647#M52915</guid>
      <dc:creator>SteveM_UK</dc:creator>
      <dc:date>2016-05-02T15:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The COALESCE function requires its arguments to be of the same data type.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267671#M52923</link>
      <description>Thank you all for the help!</description>
      <pubDate>Mon, 02 May 2016 16:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-COALESCE-function-requires-its-arguments-to-be-of-the/m-p/267671#M52923</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-02T16:55:13Z</dc:date>
    </item>
  </channel>
</rss>

