<?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: Get previous day of week? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73629#M15840</link>
    <description>SAS numeric date variable is integer value, representing days since 1/1/1960.  So if you use INTNX to get back to the start of the prior week (Sunday) and then count forward +3, you will have the Wednesday date. &lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
documentation date introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
intnx site:sas.com</description>
    <pubDate>Tue, 21 Sep 2010 16:51:32 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-09-21T16:51:32Z</dc:date>
    <item>
      <title>Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73628#M15839</link>
      <description>Hi guys,&lt;BR /&gt;
&lt;BR /&gt;
How would I do the date math to get last Wednesday based on today's date?&lt;BR /&gt;
&lt;BR /&gt;
I know it's going to use INTNX somehow but I can't seem to think it through..&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Tue, 21 Sep 2010 16:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73628#M15839</guid>
      <dc:creator>FrankE</dc:creator>
      <dc:date>2010-09-21T16:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73629#M15840</link>
      <description>SAS numeric date variable is integer value, representing days since 1/1/1960.  So if you use INTNX to get back to the start of the prior week (Sunday) and then count forward +3, you will have the Wednesday date. &lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
documentation date introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
intnx site:sas.com</description>
      <pubDate>Tue, 21 Sep 2010 16:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73629#M15840</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-09-21T16:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73630#M15841</link>
      <description>Since you are looking for a Wednesday, you could also use 'middle' as the alignment parameter instead of incrementing by three.&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
	LastWednesday = intnx('week', today(), 0, 'middle');&lt;BR /&gt;
	if LastWednesday &amp;gt;= today() then LastWednesday + -7;&lt;BR /&gt;
	put LastWednesday = weekdate.;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 21 Sep 2010 17:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73630#M15841</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-09-21T17:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73631#M15842</link>
      <description>What answer do you expect tomorrow Wednesday Sep 22,2010?</description>
      <pubDate>Tue, 21 Sep 2010 20:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73631#M15842</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-09-21T20:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73632#M15843</link>
      <description>Hey guys,&lt;BR /&gt;
&lt;BR /&gt;
thanks for all your help.. The actual requirement was to come up with a start date of 2 Saturdays ago and and end date of the previous Saturday.  Both in DATE9. format.  I needed to get them into macro vars so I used %let instead:&lt;BR /&gt;
&lt;BR /&gt;
%let start_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, "&amp;amp;SYSDATE"D, -1))-1),DATE9.));&lt;BR /&gt;
	%let end_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, "&amp;amp;SYSDATE"D, 0))-1),DATE9.));</description>
      <pubDate>Tue, 21 Sep 2010 20:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73632#M15843</guid>
      <dc:creator>FrankE</dc:creator>
      <dc:date>2010-09-21T20:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73633#M15844</link>
      <description>I think you can simplify this a bit with a shift index and SYSFUNC's little known format parameter.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
INTNX(interval&lt;MULTIPLE&gt;&amp;lt;.shift-index&amp;gt;, start-from, increment&amp;lt;, 'alignment'&amp;gt;) &lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
5006  %let start_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, "&amp;amp;SYSDATE"D, -1))-1),DATE9.));&lt;BR /&gt;
5007  %let end_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, "&amp;amp;SYSDATE"D, 0))-1),DATE9.));&lt;BR /&gt;
5008&lt;BR /&gt;
5009&lt;BR /&gt;
5010  %put  &amp;amp;START_DATE &amp;amp;END_DATE;&lt;BR /&gt;
11SEP2010 18SEP2010&lt;BR /&gt;
5011&lt;BR /&gt;
5012&lt;BR /&gt;
5013  %let start_date = %sysfunc(intnx(week.7, "&amp;amp;SYSDATE"D, -1),date9.);&lt;BR /&gt;
5014  %let end_date   = %sysfunc(intnx(week.7, "&amp;amp;SYSDATE"D,  0),date9.);&lt;BR /&gt;
5015&lt;BR /&gt;
5016&lt;BR /&gt;
5017  %put  &amp;amp;START_DATE &amp;amp;END_DATE;&lt;BR /&gt;
11SEP2010 18SEP2010&lt;BR /&gt;
[/pre]&lt;/MULTIPLE&gt;</description>
      <pubDate>Wed, 22 Sep 2010 17:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73633#M15844</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-09-22T17:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73634#M15845</link>
      <description>ohhh much better!  thanks for the tip!!</description>
      <pubDate>Thu, 23 Sep 2010 15:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73634#M15845</guid>
      <dc:creator>FrankE</dc:creator>
      <dc:date>2010-09-23T15:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73635#M15846</link>
      <description>Lots of good info on using SAS dates here:&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:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73635#M15846</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2010-12-13T15:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get previous day of week?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73636#M15847</link>
      <description>Or another choice.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
options mprint mlogic symbolgen;&lt;BR /&gt;
%let start_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, %sysfunc(today()), -1))-1),DATE9.));&lt;BR /&gt;
%let end_date = %sysfunc(putn(%eval(%sysfunc(intnx(week, %sysfunc(today()), 0))-1),DATE9.)); &lt;BR /&gt;
%put _user_;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 14 Dec 2010 08:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-previous-day-of-week/m-p/73636#M15847</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-14T08:36:16Z</dc:date>
    </item>
  </channel>
</rss>

