<?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: Result of WHEN clause 2 is not the same data type in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431189#M27837</link>
    <description>&lt;P&gt;If it did solve your problem, please mark &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32246"&gt;@ChrisBrooks&lt;/a&gt;' post as the solution.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jan 2018 07:28:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-01-26T07:28:24Z</dc:date>
    <item>
      <title>Result of WHEN clause 2 is not the same data type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431131#M27830</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I received this error when I tried to do a count distinct with conditions in proc sql:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table cnt_SOR as&lt;BR /&gt;select &lt;BR /&gt; default_dt_yyyymm,&lt;BR /&gt; count(distinct (case when app_sys_no = '337' then obligor_no else 0 end)) as Cnt337, &lt;BR /&gt; count(distinct (case when app_sys_no = '339' then obligor_no else 0 end)) as Cnt339, &lt;BR /&gt; count(distinct (case when app_sys_no = '342' then obligor_no else 0 end)) as Cnt342, &lt;BR /&gt; count(distinct (case when app_sys_no = '362' then obligor_no else 0 end)) as Cnt362 &lt;BR /&gt;from auto_LGD&lt;BR /&gt;where default_dt_yyyymm &amp;gt;= 201501 and app_sys_no in ('337', '339', '342', '362')&lt;BR /&gt;group by 1 order by 1;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;ERROR: Result of WHEN clause 2 is not the same data type as the preceding results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone help me on what's going on? app_sys_no is character format, and I don't see other data type conflicts here.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 23:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431131#M27830</guid>
      <dc:creator>Bankshot</dc:creator>
      <dc:date>2018-01-25T23:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Result of WHEN clause 2 is not the same data type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431134#M27831</link>
      <description>&lt;P&gt;The problem isn't with app_sys_no - it's because obligor is, presumably, character and 0 is of course numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you change your case&amp;nbsp;statements to read as follows you should be OK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;count(distinct (case when app_sys_no = '337' then obligor_no else "" end)) as Cnt337, 
count(distinct (case when app_sys_no = '339' then obligor_no else "" end)) as Cnt339, 
count(distinct (case when app_sys_no = '342' then obligor_no else "" end)) as Cnt342, 
count(distinct (case when app_sys_no = '362' then obligor_no else "" end)) as Cnt362 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jan 2018 00:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431134#M27831</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-01-26T00:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Result of WHEN clause 2 is not the same data type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431147#M27834</link>
      <description>&lt;P&gt;Thanks Chris!&amp;nbsp; This was very helpful&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 01:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431147#M27834</guid>
      <dc:creator>Bankshot</dc:creator>
      <dc:date>2018-01-26T01:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Result of WHEN clause 2 is not the same data type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431189#M27837</link>
      <description>&lt;P&gt;If it did solve your problem, please mark &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32246"&gt;@ChrisBrooks&lt;/a&gt;' post as the solution.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 07:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Result-of-WHEN-clause-2-is-not-the-same-data-type/m-p/431189#M27837</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-26T07:28:24Z</dc:date>
    </item>
  </channel>
</rss>

