<?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: Expression using IN has components that are of different data types. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916953#M361184</link>
    <description>&lt;P&gt;Like the Error tells you there must be a mismatch between the type of your variable and the values for the IN clause.&lt;/P&gt;
&lt;PRE&gt;                            and a.inptid in (&amp;amp;role1.)
                            and (c.srcstcd not in ('5','6') or c.srcstcd is null)
                            and (d.pur_id not in ('0001234','0005678') or d.pur_id is null)&lt;/PRE&gt;
&lt;P&gt;For example if&amp;nbsp;d.pur_id is of type numeric then the values in the IN clause shouldn't be in quotes as this indicates they are strings and not numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What confuses me a bit:&lt;/P&gt;
&lt;P&gt;The code itself is explicit pass-through code so if there is such a type mismatch then I would have expected to see some Oracle error and not - how it looks like - a SAS error message. Are you showing us the exact code that returns this error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2024 11:33:33 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-02-20T11:33:33Z</dc:date>
    <item>
      <title>ERROR: Expression using IN has components that are of different data types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916860#M361140</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
     /*connect to oracle as test (user=%SUPERQ(dra_u) password="&amp;amp;dra_p." path=huvhg); */

        create table now1(drop=crdttm) as
           select *, 
		  crdttm as act_dttm format=datetime24.3
			from connection to test
                (select distinct a.act_dttm,
                                 a.id,
                                 a.acttpcd,
                                 a.actrscd,
                                 a.actotcom_cd,                            
                                 a.inptid as emp_id,
                                 a.cmtrid,
                                 a.act_dttm as crdttm,
         			 c.mktcd,
                                 c.srcstcd,
                                 d.pur_id,
                                 d.bol_cd,
                                 d.clmplcd,
			         d.ent,
                             case when d.plancd in ('MMM','RRR','DDDD') then 'RNM'
                                  else 'INE'
                             end as Business,
                                 d.plancd
          
                    from dra.rsh_dra_snart_act as a

                       left join dra.rsh_dra_case as c
                          on a.id = c.id

                       left join dra.rsh_dra_nonmdm_mbr as d
                          on c.id = d.id 
				
                     	where a.act_dttm between (&amp;amp;start. and &amp;amp;end.)
                            and a.inptid in (&amp;amp;role1.)
                            and (c.srcstcd not in ('5','6') or c.srcstcd is null)
                            and (d.pur_id not in ('0001234','0005678') or d.pur_id is null)
    
                    );
                         
quit;

ERROR: Expression using IN has components that are of different data types.
NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL WHERE clause optimization.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not sure what is causing this error.&amp;nbsp; The macros run fine but it's something with the last few lines of the program.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 20:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916860#M361140</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2024-02-19T20:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Expression using IN has components that are of different data types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916865#M361141</link>
      <description>&lt;P&gt;From now on, please show us the log, instead of ERROR messages detached from the code. In this case, we need the PROC SQL log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of these three IN statements is a problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;                     	where a.act_dttm between (&amp;amp;start. and &amp;amp;end.)
                            and a.inptid in (&amp;amp;role1.)
                            and (c.srcstcd not in ('5','6') or c.srcstcd is null)
                            and (d.pur_id not in ('0001234','0005678') or d.pur_id is null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please tell use the value of &amp;amp;role1. Also please tell us if INPTID is numeric or character, and if SRCSTCD is numeric or character, and if PUT_ID is numeric or character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 21:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916865#M361141</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-19T21:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Expression using IN has components that are of different data types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916906#M361167</link>
      <description>&lt;P&gt;We can't see your data.&amp;nbsp; We can't see what is in your macro variables.&amp;nbsp; So we are guessing.&amp;nbsp; But here is my guess.&amp;nbsp; SImplify this part of your query:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
                            and (c.srcstcd not in ('5','6') or c.srcstcd is null)
                            and (d.pur_id not in ('0001234','0005678') or d.pur_id is null)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even if the query were working successfully, you would get the same result by using:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
                            and (c.srcstcd not in ('5','6') )
                            and (d.pur_id not in ('0001234','0005678'))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After all, if c.srcstcd is null, the first condition about it not being '5' or '6' would capture the observation.&amp;nbsp; So even if this doesn't turn out to be the source of your error, at least you can simplify the program without changing the meaning of the query.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 03:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916906#M361167</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-02-20T03:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Expression using IN has components that are of different data types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916953#M361184</link>
      <description>&lt;P&gt;Like the Error tells you there must be a mismatch between the type of your variable and the values for the IN clause.&lt;/P&gt;
&lt;PRE&gt;                            and a.inptid in (&amp;amp;role1.)
                            and (c.srcstcd not in ('5','6') or c.srcstcd is null)
                            and (d.pur_id not in ('0001234','0005678') or d.pur_id is null)&lt;/PRE&gt;
&lt;P&gt;For example if&amp;nbsp;d.pur_id is of type numeric then the values in the IN clause shouldn't be in quotes as this indicates they are strings and not numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What confuses me a bit:&lt;/P&gt;
&lt;P&gt;The code itself is explicit pass-through code so if there is such a type mismatch then I would have expected to see some Oracle error and not - how it looks like - a SAS error message. Are you showing us the exact code that returns this error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 11:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/916953#M361184</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-02-20T11:33:33Z</dc:date>
    </item>
  </channel>
</rss>

