<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14096#M2179</link>
    <description>This seems to indicate that ReportTime is a character variable in your dataset, while your first attempts compared that to a SAS datetime and so to a numeric value.&lt;BR /&gt;
&lt;BR /&gt;
(I say "seems" as I can't test/verify for the time being)</description>
    <pubDate>Wed, 13 Oct 2010 07:27:47 GMT</pubDate>
    <dc:creator>Robert_Bardos</dc:creator>
    <dc:date>2010-10-13T07:27:47Z</dc:date>
    <item>
      <title>ERROR: Expression using IN has components that are of different data types.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14088#M2171</link>
      <description>Hi everyone!&lt;BR /&gt;
&lt;BR /&gt;
I'm having an issue with the below code and the error in the Subject.&lt;BR /&gt;
&lt;BR /&gt;
%let MTDFromDate= '01-oct-2010:00:00:000'dt;&lt;BR /&gt;
%let MTDToDate = '10-oct-2010:00:00:000'dt;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as&lt;BR /&gt;
select * from jennifer.vccart_sceintrvl&lt;BR /&gt;
WHERE ReportTime ge &amp;amp;MTDfromdate and ReportTime le &amp;amp;MTDTodate;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Log &lt;BR /&gt;
&lt;BR /&gt;
212  %let MTDFromDate= '01-oct-2010:00:00:000'dt;&lt;BR /&gt;
213  %let MTDToDate = '10-oct-2010:00:00:000'dt;&lt;BR /&gt;
214  proc sql;&lt;BR /&gt;
215  create table test as&lt;BR /&gt;
216  select * from jennifer.vccart_sceintrvl&lt;BR /&gt;
217  WHERE ReportTime ge &amp;amp;MTDfromdate and ReportTime le &amp;amp;MTDTodate;&lt;BR /&gt;
ERROR: Expression using IN has components that are of different data types.&lt;BR /&gt;
NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL&lt;BR /&gt;
      where clause optimization.&lt;BR /&gt;
218  quit;&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           0.39 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Help Please&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Fri, 08 Oct 2010 15:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14088#M2171</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-10-08T15:46:32Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14089#M2172</link>
      <description>The diagnostic message is telling you that your variable/column ReportTime in your source/input file is not in the same format as the SAS DATETIME literal constant you have coded.  You will need to address this, possibly, by using an INPUT function in your WHERE clause to convert the variable from CHARACTER to NUMERIC using the appropriate SAS INFORMAT.&lt;BR /&gt;
&lt;BR /&gt;
A search of the SAS support website with your ERROR message will also turn up some suitable references, as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
proc sql input function where clause site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Expression using IN has components that are of different data types  site:sas.com</description>
      <pubDate>Fri, 08 Oct 2010 16:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14089#M2172</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-08T16:51:21Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14090#M2173</link>
      <description>Hi. I am curious that my code is worked.&lt;BR /&gt;
Perhaps, the form of your datetime is not right.Should be '10nov2005:3:49:19am'dt  or  '10nov2005:03:49:19'dt&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let MTDFromDate= '01jan1998'd;&lt;BR /&gt;
%let MTDToDate = '01jan2005'd;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as&lt;BR /&gt;
select * from sashelp.buy&lt;BR /&gt;
WHERE date ge &amp;amp;MTDfromdate and date le &amp;amp;MTDTodate;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp</description>
      <pubDate>Mon, 11 Oct 2010 08:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14090#M2173</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-10-11T08:12:18Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14091#M2174</link>
      <description>Hi Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Sorry your code resulted in the below error.&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Expression using IN has components that are of different data types.&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Tue, 12 Oct 2010 11:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14091#M2174</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-10-12T11:33:00Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14092#M2175</link>
      <description>Top the OP: did you investigate / research my reply, especially by searching the SAS support website using the error message as your search argument?  You will find that others have encountered the same condition.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 12 Oct 2010 12:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14092#M2175</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-12T12:30:01Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14093#M2176</link>
      <description>Hi sbb&lt;BR /&gt;
&lt;BR /&gt;
Yes i have been looking all weekend but can't find anything that explains it so i can understand.&lt;BR /&gt;
&lt;BR /&gt;
Reading and more reading, tried many many variations without success.&lt;BR /&gt;
&lt;BR /&gt;
If anyone has an example please that would be great.&lt;BR /&gt;
&lt;BR /&gt;
Fred&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: fredbell&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: fredbell

Message was edited by: fredbell</description>
      <pubDate>Tue, 12 Oct 2010 14:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14093#M2176</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-10-12T14:08:47Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14094#M2177</link>
      <description>Look up what data type the variable "ReportTime" has on the table Jennifer. vccart_sceintrvl. &lt;BR /&gt;
&lt;BR /&gt;
Then change your macro variables to have the same format.  &lt;BR /&gt;
&lt;BR /&gt;
Can't provide an example since we don't know what format that is in.  This is the simplest solution IMO. Scott's solution and the examples found by searching would work as well...</description>
      <pubDate>Tue, 12 Oct 2010 16:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14094#M2177</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2010-10-12T16:39:58Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14095#M2178</link>
      <description>So very frustrating, below code finally worked.&lt;BR /&gt;
&lt;BR /&gt;
%let MTDFromDate= '2010-10-01 00:00:00.000000';&lt;BR /&gt;
%let MTDToDate = '2010-10-12 00:00:00.000000';&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as&lt;BR /&gt;
select * from jennifer.vccart_sceintrvl&lt;BR /&gt;
WHERE ReportTime ge &amp;amp;MTDfromdate and ReportTime le &amp;amp;MTDTodate;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Tue, 12 Oct 2010 17:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14095#M2178</guid>
      <dc:creator>fredbell</dc:creator>
      <dc:date>2010-10-12T17:21:19Z</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-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14096#M2179</link>
      <description>This seems to indicate that ReportTime is a character variable in your dataset, while your first attempts compared that to a SAS datetime and so to a numeric value.&lt;BR /&gt;
&lt;BR /&gt;
(I say "seems" as I can't test/verify for the time being)</description>
      <pubDate>Wed, 13 Oct 2010 07:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ERROR-Expression-using-IN-has-components-that-are-of-different/m-p/14096#M2179</guid>
      <dc:creator>Robert_Bardos</dc:creator>
      <dc:date>2010-10-13T07:27:47Z</dc:date>
    </item>
  </channel>
</rss>

