<?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 Macro For A Date Range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62804#M13656</link>
    <description>I currently have the following:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select&lt;BR /&gt;
 a.id,&lt;BR /&gt;
 b.logon_id,&lt;BR /&gt;
 b.enter_date,&lt;BR /&gt;
 b.cd,&lt;BR /&gt;
 b.bef_desc,&lt;BR /&gt;
 b.aft_desc&lt;BR /&gt;
from&lt;BR /&gt;
 fs.ROOT_VIEW  a,&lt;BR /&gt;
 fs.t_trans  b&lt;BR /&gt;
where &lt;BR /&gt;
 a.id=b.id and &lt;BR /&gt;
enter_date between to_date(07/01/2010,mm/dd/yyyy') and  to_date(07/01/2010,mm/dd/yyyy')  ;&lt;BR /&gt;
&lt;BR /&gt;
I want to write a macro so that when this runs monthly, I won't have to physically change the date range. I'm not sure how to go about this since it's a Proc SQL. Any suggesstions?</description>
    <pubDate>Wed, 11 Aug 2010 13:53:57 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-08-11T13:53:57Z</dc:date>
    <item>
      <title>Macro For A Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62804#M13656</link>
      <description>I currently have the following:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select&lt;BR /&gt;
 a.id,&lt;BR /&gt;
 b.logon_id,&lt;BR /&gt;
 b.enter_date,&lt;BR /&gt;
 b.cd,&lt;BR /&gt;
 b.bef_desc,&lt;BR /&gt;
 b.aft_desc&lt;BR /&gt;
from&lt;BR /&gt;
 fs.ROOT_VIEW  a,&lt;BR /&gt;
 fs.t_trans  b&lt;BR /&gt;
where &lt;BR /&gt;
 a.id=b.id and &lt;BR /&gt;
enter_date between to_date(07/01/2010,mm/dd/yyyy') and  to_date(07/01/2010,mm/dd/yyyy')  ;&lt;BR /&gt;
&lt;BR /&gt;
I want to write a macro so that when this runs monthly, I won't have to physically change the date range. I'm not sure how to go about this since it's a Proc SQL. Any suggesstions?</description>
      <pubDate>Wed, 11 Aug 2010 13:53:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62804#M13656</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-11T13:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro For A Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62805#M13657</link>
      <description>I don't think "to_date(07/01/2010,mm/dd/yyyy') " is base SAS syntax. You might use something like that in "explicit pass-through sql" subject to the sql flavor of the underlying dbms.&lt;BR /&gt;
SAS becomes simpler if you can use "implicit pass-through sql queries". Then your date filter clause can be just [pre]    and enter_date between "&amp;amp;from_date"d and "&amp;amp;to_date"d[/pre] where macro variables &amp;amp;from_date and &amp;amp;to_date are filled in base SAS code to look like 10Aug2010 and 21Jul2010. &lt;BR /&gt;
The handling of implicit-pass-through syntax by PROC SQL will re-present SAS date constants in the query that is passed to the dbms so that they are in the style that that dbms needs.&lt;BR /&gt;
 &lt;BR /&gt;
sorry it is sounding convoluted - but that is the way it seems (to me).&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Wed, 11 Aug 2010 15:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62805#M13657</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-08-11T15:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro For A Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62806#M13658</link>
      <description>good done&lt;BR /&gt;
thank you</description>
      <pubDate>Mon, 30 Aug 2010 16:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62806#M13658</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-30T16:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro For A Date Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62807#M13659</link>
      <description>Lots of good info on using SAS dates here.  Hopefully, this will help.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm&lt;/A&gt;</description>
      <pubDate>Mon, 13 Dec 2010 15:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-For-A-Date-Range/m-p/62807#M13659</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2010-12-13T15:54:11Z</dc:date>
    </item>
  </channel>
</rss>

