<?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: date sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385197#M92113</link>
    <description>&lt;P&gt;When you do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symput('start',put(start_date,yymmddn8.));
call symput('end',put(end_date,yymmddn8.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you create macro values of the form&lt;/P&gt;
&lt;PRE&gt;20170801&lt;/PRE&gt;
&lt;P&gt;Then you issue this WHERE condition:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where proc_dt between &amp;amp;start. and &amp;amp;end.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which will end up like this after the macrovars are resolved:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where proc_dt between 20170801 and 20170801;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If proc_dt is a SAS date value (days from 1960-01-01), this cannot work.&lt;/P&gt;
&lt;P&gt;Therefore follow my Maxim 28 and store dates as the raw numerical values into macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symput('start',put(start_date,best.));
call symput('end',put(end_date,best.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that these calculations won't work in January:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
curr_year = year(today());
cu_month = month(today());
La_month = month(today())-1;
length string1 $6 string2 $6;
string1= put(curr_year,z4.) !! put(cu_month,z2.);
string2= put(curr_year,z4.) !! put(La_month,z2.);
call symput('current_month',string1);
call symput('Last_Month',string2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When determining previous or following periods, always use the intnx() function and the derive year and month values off the result.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2017 08:09:04 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-03T08:09:04Z</dc:date>
    <item>
      <title>date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385176#M92104</link>
      <description>&lt;P&gt;hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;today = today();&lt;/P&gt;&lt;P&gt;day_of_week = weekday(today);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; day_of_week = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;start_date = today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;end_date = today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;else&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;start_date = today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;end_date = today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;days = end_date - start_date;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'start'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(start_date,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'end'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(end_date,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;curr_year = year(today());&lt;/P&gt;&lt;P&gt;cu_month = month(today());&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;La_month = month(today())-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; string1 $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; string2 $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;string1= put(curr_year,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;z4.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) !! put(cu_month,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;z2.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;string2= put(curr_year,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;z4.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) !! put(La_month,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;z2.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'current_month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,string1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Last_Month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,string2);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; temping;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;keep&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mer_id trn_ac_nbr &lt;/FONT&gt;proc_dt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; libr.ab002_&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;current_month.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; libr.ab002_&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;Last_Month.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; proc_dt between &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;start.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; and &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;end.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;the above code ran with 0 onservations , though the datasets had data.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I guess the error is in the datepart/format /informat i use in &amp;amp;start.and *end. macro.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;also Proc_dt is&amp;nbsp;in datatime20. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 03:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385176#M92104</guid>
      <dc:creator>SAS_INFO</dc:creator>
      <dc:date>2017-08-03T03:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385177#M92105</link>
      <description>Could you please share the log</description>
      <pubDate>Thu, 03 Aug 2017 04:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385177#M92105</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-08-03T04:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385192#M92111</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Is proc_dt a numeric variable with datetime format attached, or is it alphanumeric? if the proc_dt is numeric than changing&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'start'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(start_date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'end'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,put(end_date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;to&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'start'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, start_date&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'end'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, end_date&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;will solve the issue.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 07:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385192#M92111</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-08-03T07:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385193#M92112</link>
      <description>&lt;P&gt;The calculation of last month can be modified, I mean what will happen if cu_month = 1, then the la_month and year will change.&amp;nbsp;&lt;BR /&gt;also If proc_dt is compared with macro variables it should be date constant.&amp;nbsp;&lt;BR /&gt;Like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call symput('start',put(start_date,date9.));&lt;BR /&gt;call symput('end',put(end_date,date9.));&lt;/P&gt;
&lt;P&gt;and where condition should be :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where proc_dt between "&amp;amp;start."d and "&amp;amp;end."d;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the calculation of start and end can be modified using sas date functions.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 07:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385193#M92112</guid>
      <dc:creator>cpagrawal</dc:creator>
      <dc:date>2017-08-03T07:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385197#M92113</link>
      <description>&lt;P&gt;When you do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symput('start',put(start_date,yymmddn8.));
call symput('end',put(end_date,yymmddn8.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you create macro values of the form&lt;/P&gt;
&lt;PRE&gt;20170801&lt;/PRE&gt;
&lt;P&gt;Then you issue this WHERE condition:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where proc_dt between &amp;amp;start. and &amp;amp;end.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which will end up like this after the macrovars are resolved:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where proc_dt between 20170801 and 20170801;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If proc_dt is a SAS date value (days from 1960-01-01), this cannot work.&lt;/P&gt;
&lt;P&gt;Therefore follow my Maxim 28 and store dates as the raw numerical values into macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symput('start',put(start_date,best.));
call symput('end',put(end_date,best.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that these calculations won't work in January:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
curr_year = year(today());
cu_month = month(today());
La_month = month(today())-1;
length string1 $6 string2 $6;
string1= put(curr_year,z4.) !! put(cu_month,z2.);
string2= put(curr_year,z4.) !! put(La_month,z2.);
call symput('current_month',string1);
call symput('Last_Month',string2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When determining previous or following periods, always use the intnx() function and the derive year and month values off the result.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 08:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385197#M92113</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-03T08:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: date sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385212#M92118</link>
      <description>&lt;P&gt;There are two issues here. &amp;nbsp;First, as Kurt mentioned, except on Thursdays, START_DATE = END_DATE. &amp;nbsp;It looks like a little revision to the formulas might be necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, dates and datetimes are on completely different scales. &amp;nbsp;You won't find a datetime&amp;nbsp;value falling BETWEEN two date values. &amp;nbsp;If PROC_DT is a true SAS datetime value, you would need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;datepart(&lt;/SPAN&gt;proc_dt) between &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;start.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;end.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If PROC_DT is actually a character string (and a PROC CONTENTS will tell you this), the formula is more complex. &amp;nbsp;It might look like this, but I would need to see the form of the values in PROC_DT and possibly fiddle with the formula to be sure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;datepart( input(&lt;/SPAN&gt;proc_dt,anydtdte.) ) between &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;start.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and &amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;end.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 08:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-sas/m-p/385212#M92118</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-03T08:53:56Z</dc:date>
    </item>
  </channel>
</rss>

