<?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: PROC SQL Date Range in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279473#M58987</link>
    <description>&lt;P&gt;I tried this solution and it didn't work. I get the error message:&amp;nbsp;ERROR: INPUT function reported 'ERROR: Invalid date value' while processing WHERE clause. The variable FilledMonth is character and it has a format of $7.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 18:22:10 GMT</pubDate>
    <dc:creator>JediApprentice</dc:creator>
    <dc:date>2016-06-22T18:22:10Z</dc:date>
    <item>
      <title>PROC SQL Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279433#M58983</link>
      <description>&lt;P&gt;I'm trying to specify a range of dates in my where clause, but the dates (FilledMonth and Date literal) are of different formats. FilledMonth is in the format&amp;nbsp;&lt;SPAN&gt;YYMM&lt;/SPAN&gt;w.&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;(2015M01). Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error message I'm receiving is: "Expression using IN has components that are of different data types." There is no IN, I understand this to mean that the dates are of different formats. How do I get the date literals into same format as FilledMonth?&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 17:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279433#M58983</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-06-22T17:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279451#M58984</link>
      <description>&lt;P&gt;First thing to check is the datatype of FilledMonth. Easy to do as this seems to be Enterprise Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I must assume it is character and has the character representation of the date. Use the INPUT() function to convert to a proper date value (integer, #days since 01JAN1960). 2015M01 will translate to January first, 2015.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE (INPUT(FilledMonth, MONYY8.) BETWEEN '01jan2015'd AND '31dec2015'd) AND CLIENT = 'BCBS NC';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 17:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279451#M58984</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-06-22T17:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279473#M58987</link>
      <description>&lt;P&gt;I tried this solution and it didn't work. I get the error message:&amp;nbsp;ERROR: INPUT function reported 'ERROR: Invalid date value' while processing WHERE clause. The variable FilledMonth is character and it has a format of $7.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 18:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279473#M58987</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-06-22T18:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279560#M58990</link>
      <description>&lt;P&gt;Choose an informat that corresponds to your FilledMonth strings! We could suggest some if you gave us a sample of FilledMonth values.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-Date-Range/m-p/279560#M58990</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-06-22T20:25:38Z</dc:date>
    </item>
  </channel>
</rss>

