<?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 Disparate Date Types in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279537#M56342</link>
    <description>&lt;P&gt;I have a where clause that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE (FilledMonth BETWEEN '01jan2015'd AND '31dec2015'd) AND CLIENT = 'BCBS NC';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The variable FilledMonth is character and it has a format of $7. In the data it looks like: 2015M01. However, when I run it, I get&amp;nbsp;an error related to the different data types of FilledMonth and the date literals. Is there a way around this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The error message: "Expression using IN has components that are of different data types."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The full query is here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
  CREATE TABLE EGTASK.NC_SAVINGS AS
  SELECT t1.FilledMonth,
         t1.Client,
		 t1.Business_Line,
		 t1.Segment,
		 t1.MACSavingsGrouping AS Channel,
		 t1.Specialty_Flag,
		 t1.BRAND_GENERIC,
		 t1.ApprovedPriceType,
		 t1.SUM_OF_AWP,
		 t1.SUM_OF_APPROVEDINGREDIENTCOST,
         t1.SUM_OF_ADFA,
		 t1.SUM_OF_RX
  FROM EGTASK.All_Combined_Table t1
  WHERE (FilledMonth BETWEEN '01jan2015'd AND '31dec2015'd) AND CLIENT = 'BCBS NC';
QUIT;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Jun 2016 19:35:37 GMT</pubDate>
    <dc:creator>JediApprentice</dc:creator>
    <dc:date>2016-06-22T19:35:37Z</dc:date>
    <item>
      <title>Disparate Date Types</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279537#M56342</link>
      <description>&lt;P&gt;I have a where clause that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE (FilledMonth BETWEEN '01jan2015'd AND '31dec2015'd) AND CLIENT = 'BCBS NC';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The variable FilledMonth is character and it has a format of $7. In the data it looks like: 2015M01. However, when I run it, I get&amp;nbsp;an error related to the different data types of FilledMonth and the date literals. Is there a way around this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The error message: "Expression using IN has components that are of different data types."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The full query is here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;
  CREATE TABLE EGTASK.NC_SAVINGS AS
  SELECT t1.FilledMonth,
         t1.Client,
		 t1.Business_Line,
		 t1.Segment,
		 t1.MACSavingsGrouping AS Channel,
		 t1.Specialty_Flag,
		 t1.BRAND_GENERIC,
		 t1.ApprovedPriceType,
		 t1.SUM_OF_AWP,
		 t1.SUM_OF_APPROVEDINGREDIENTCOST,
         t1.SUM_OF_ADFA,
		 t1.SUM_OF_RX
  FROM EGTASK.All_Combined_Table t1
  WHERE (FilledMonth BETWEEN '01jan2015'd AND '31dec2015'd) AND CLIENT = 'BCBS NC';
QUIT;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jun 2016 19:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279537#M56342</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-06-22T19:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Disparate Date Types</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279556#M56349</link>
      <description>&lt;P&gt;You'll have to make the BETWEEN values match the values for FilledMonth, possibly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where (FilledMonth between '2015M01' and '2015M12') ...&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279556#M56349</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-22T20:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Disparate Date Types</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279558#M56350</link>
      <description>&lt;P&gt;This seems to be because your FilledMonth data is a character format, but you're comparing to dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try something like a modified version of what is suggested in &lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/how-to-convert-char-var-to-sas-date/td-p/45067" target="_self"&gt;this post&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;select input(trim(FilledMonth), MMDDYY10.) as FilledMonth_dateFmt&lt;/PRE&gt;&lt;P&gt;The other comments in that thread discuss different ways to get rid of extra space (your FilledMonth variable may be longer than just seven characters wide).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279558#M56350</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-06-22T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Disparate Date Types</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279570#M56352</link>
      <description>&lt;P&gt;As indicated in your other question here&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279473#M58987" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279473#M58987&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to find the correct format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case it's yymm7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE (INPUT(FilledMonth, yymm7.) BETWEEN '01jan2015'd AND '31dec2015'd)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want your date variables to be actual dates convert them to dates, don't store them as character variables.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 21:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Disparate-Date-Types/m-p/279570#M56352</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-22T21:48:22Z</dc:date>
    </item>
  </channel>
</rss>

