<?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 - Get data in a dynamic rage of days. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/531244#M145375</link>
    <description>&lt;P&gt;It worked. Thank so much.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 03:36:18 GMT</pubDate>
    <dc:creator>Tri_Luong</dc:creator>
    <dc:date>2019-01-30T03:36:18Z</dc:date>
    <item>
      <title>Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530568#M145116</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanna use Proc SQL to create a new table in which I would like to get the observations with condition "WHERE" that REPORT_DATE between "&lt;U&gt;first date of x+1 month(s) ag&lt;/U&gt;o" and "2 days after last date of x month(s) ago". For eg.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If x = 1 --&amp;gt; data from 01/11/2018 to 03/01/2019.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tri Luong.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 09:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530568#M145116</guid>
      <dc:creator>Tri_Luong</dc:creator>
      <dc:date>2019-01-28T09:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530570#M145118</link>
      <description>&lt;P&gt;Please show test data in the form of a datastep:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then show what you want out from that test data.&amp;nbsp; Saying you want to code something very vague will not get you good answers.&lt;/P&gt;
&lt;P&gt;At a guess, join on the dates having min()per group and max() per group joined by group, then you will have all the information on each row.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 09:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530570#M145118</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-01-28T09:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530651#M145135</link>
      <description>&lt;P&gt;Is this "x months ago" from the Report_date variable or some other variable or date? Where does the value for X come from, a variable, calculated or fixed in the code?&lt;/P&gt;
&lt;P&gt;And possibly a critical question: Is report_date a SAS date value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 15:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530651#M145135</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-28T15:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530720#M145147</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/214133"&gt;@Tri_Luong&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanna use Proc SQL to create a new table in which I would like to get the observations with condition "WHERE" that REPORT_DATE between "&lt;U&gt;first date of x+1 month(s) ag&lt;/U&gt;o" and "2 days after last date of x month(s) ago". For eg.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If x = 1 --&amp;gt; data from 01/11/2018 to 03/01/2019.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your help.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Tri Luong.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By AGO I assume you mean relative to the day that the program is run. You can use the DATE() function (alias TODAY()) to get the current date or "&amp;amp;sysdate9"d to get the date that the SAS session started.&lt;/P&gt;
&lt;P&gt;To calculate a relative date use the INTNX() function.&lt;/P&gt;
&lt;P&gt;Let's assume X is in macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;REPORT_DATE between
intnx('month',"&amp;amp;sysdate9"d,-&amp;amp;x-1,'b')
and
intnx('month',"&amp;amp;sysdate9"d,-&amp;amp;x,'e')+2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jan 2019 18:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/530720#M145147</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-28T18:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/531239#M145371</link>
      <description>&lt;P&gt;Thank for your response,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;About "X", I meant it is fixed value will be declared manually by user depending on their purpose in certain situation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/531239#M145371</guid>
      <dc:creator>Tri_Luong</dc:creator>
      <dc:date>2019-01-30T03:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Get data in a dynamic rage of days.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/531244#M145375</link>
      <description>&lt;P&gt;It worked. Thank so much.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Get-data-in-a-dynamic-rage-of-days/m-p/531244#M145375</guid>
      <dc:creator>Tri_Luong</dc:creator>
      <dc:date>2019-01-30T03:36:18Z</dc:date>
    </item>
  </channel>
</rss>

