<?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 How to pull data with changing date ranges - PROC SQL in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54367#M15032</link>
    <description>Hello i have 2 tables.  Table X has EMAIL and DATE and table Y has EMAIL, DATE, and SALES.   i want to pull all sales for the previous year from Y for emails based on a day before their DATE in X.  so the date range in Y will be constantly changing by EMAIL based on X.DATE.  I need to use sql code to access the server.&lt;BR /&gt;
&lt;BR /&gt;
so the date part of the query would be &lt;BR /&gt;
y.date between x.date-366 and x.date-1&lt;BR /&gt;
&lt;BR /&gt;
can somebody tell me how to do this?</description>
    <pubDate>Thu, 22 Jul 2010 14:11:05 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-07-22T14:11:05Z</dc:date>
    <item>
      <title>How to pull data with changing date ranges - PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54367#M15032</link>
      <description>Hello i have 2 tables.  Table X has EMAIL and DATE and table Y has EMAIL, DATE, and SALES.   i want to pull all sales for the previous year from Y for emails based on a day before their DATE in X.  so the date range in Y will be constantly changing by EMAIL based on X.DATE.  I need to use sql code to access the server.&lt;BR /&gt;
&lt;BR /&gt;
so the date part of the query would be &lt;BR /&gt;
y.date between x.date-366 and x.date-1&lt;BR /&gt;
&lt;BR /&gt;
can somebody tell me how to do this?</description>
      <pubDate>Thu, 22 Jul 2010 14:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54367#M15032</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-22T14:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull data with changing date ranges - PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54368#M15033</link>
      <description>You have the INTNX function available to use with PROC SQL and have you considered defining a nested query? &lt;BR /&gt;
&lt;BR /&gt;
Also, do you have any code-attempts you have made on this request so far, which you can share and receive excellent input/feedback?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 22 Jul 2010 14:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54368#M15033</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-07-22T14:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull data with changing date ranges - PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54369#M15034</link>
      <description>&amp;gt; Hello i have 2 tables.  Table X has EMAIL and DATE&lt;BR /&gt;
&amp;gt; and table Y has EMAIL, DATE, and SALES.   i want to&lt;BR /&gt;
&amp;gt; pull all sales for the previous year from Y for&lt;BR /&gt;
&amp;gt; emails based on a day before their DATE in X.  so the&lt;BR /&gt;
&amp;gt; date range in Y will be constantly changing by EMAIL&lt;BR /&gt;
&amp;gt; based on X.DATE.  I need to use sql code to access&lt;BR /&gt;
&amp;gt; the server.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; so the date part of the query would be &lt;BR /&gt;
&amp;gt; y.date between x.date-366 and x.date-1&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; can somebody tell me how to do this?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; can somebody tell me how to do this?&lt;BR /&gt;
&lt;BR /&gt;
I'm sure "someone" can, but ...&lt;BR /&gt;
 &lt;BR /&gt;
since you want to run sql on the server, it might help to :&lt;BR /&gt;
1&lt;BR /&gt;
consider which server or server-type will run your code&lt;BR /&gt;
2&lt;BR /&gt;
consider telling us what server &lt;BR /&gt;
3&lt;BR /&gt;
consider using a forum that deals with that database server&lt;BR /&gt;
 &lt;BR /&gt;
good as poster/answerers on this forum generally are, mind reading is normally not available</description>
      <pubDate>Fri, 23 Jul 2010 08:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54369#M15034</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-07-23T08:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to pull data with changing date ranges - PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54370#M15035</link>
      <description>In order to give you working SQL code you would have to provide us with sample data (2 data steps creating table X and Y).&lt;BR /&gt;
&lt;BR /&gt;
Even better would be to then also give the expected result set based on the sample data sets.&lt;BR /&gt;
&lt;BR /&gt;
The SQL code can be written in SAS SQL, SAS then translates it into DB specific SQL (this works even with certain data step commands like modify).&lt;BR /&gt;
&lt;BR /&gt;
The minimum needed is to know which variables make up a unique key in the 2 tables and what the relationship between the tables is (1:1, 1:many,...).&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Fri, 23 Jul 2010 11:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-pull-data-with-changing-date-ranges-PROC-SQL/m-p/54370#M15035</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-07-23T11:16:17Z</dc:date>
    </item>
  </channel>
</rss>

