<?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: Last Wednesday AND Last Thursday (that is before Last Wednesday) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910073#M358937</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;last_WED=Intnx('week.4',date,-1,'end');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The -1 indicates you want the last Wednesday of the previous week, which is not what you asked for. How could you change this to get the last Wednesday of the current week?&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2024 13:08:05 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-01-02T13:08:05Z</dc:date>
    <item>
      <title>Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910063#M358930</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;For each date in the data set I want to :&lt;/P&gt;
&lt;P&gt;1- Last Wednesday&lt;/P&gt;
&lt;P&gt;2-Last Thursday (that is before&amp;nbsp;Last Wednesday)&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;For 15JAN2023 (Sunday) last Wednesday was 11JAN2023 and last Thursday(before last Wednesday) was 05JAN2023&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the way to calculate it and add 2 desired columns :&lt;/P&gt;
&lt;P&gt;Last_WED&lt;/P&gt;
&lt;P&gt;LAST_Thu_Before_Last_WED&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;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
format date ddmmyy10.;
input date : date9.;
cards;
15JAN2023
27MAR2023
01JAN2023
19NOV2023
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 12:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910063#M358930</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-02T12:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910064#M358931</link>
      <description>&lt;P&gt;Last Thursday before last Wednesday is easy. Once you find last Wednesday, then you subtract 6.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get last Wednesday, the INTNX function will do this, if you ask for the beginning of a week that contains a specific date using the WEEK.4 interval. (the 4 indicates Wednesday)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 12:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910064#M358931</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-02T12:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910066#M358932</link>
      <description>&lt;P&gt;One way to go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  format date lastWedDt lastThuDt weekdatx.;
  input date : date9.;
  lastWedDt=intnx('week.4',date,0,'b');
  lastThuDt=intnx('week.5',lastWedDt,0,'b');
  cards;
15JAN2023
27MAR2023
01JAN2023
19NOV2023
;

proc print data=have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1704200253385.png" style="width: 584px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92161i225B66D381E5FD3B/image-dimensions/584x130?v=v2" width="584" height="130" role="button" title="Patrick_0-1704200253385.png" alt="Patrick_0-1704200253385.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 12:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910066#M358932</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-02T12:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910068#M358933</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;However for 15JAN2023 I got last WED 10.01.2023&amp;nbsp; but it should be 11.01.2023&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
last_WED=Intnx('week.4',date,-1,'end');
Last_Thu_Before_Wed=last_WED-6;
last_WED_WeekDay=Weekday(last_WED);
Last_Thu_Before_Wed_WeekDay=Weekday(Last_Thu_Before_Wed);
format last_WED Last_Thu_Before_Wed  ddmmyy10.;
Run;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910068#M358933</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-02T13:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910070#M358934</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;If you look at the code I've posted and the result it returned then you'll see that I've used the week.4 interval same as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;proposed.&lt;/P&gt;
&lt;P&gt;If you get another result with this interval then you need to share your code.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910070#M358934</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-02T13:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910072#M358936</link>
      <description>&lt;P&gt;It is working 100%&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
last_WED=intnx('week.4',date,0,'b');
Last_Thu_Before_Wed=last_WED-6;
last_WED_WeekDay=Weekday(last_WED);
Last_Thu_Before_Wed_WeekDay=Weekday(Last_Thu_Before_Wed);
format last_WED Last_Thu_Before_Wed  ddmmyy10.;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910072#M358936</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-02T13:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910073#M358937</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;last_WED=Intnx('week.4',date,-1,'end');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The -1 indicates you want the last Wednesday of the previous week, which is not what you asked for. How could you change this to get the last Wednesday of the current week?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910073#M358937</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-02T13:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Last Wednesday AND Last Thursday (that is before Last Wednesday)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910074#M358938</link>
      <description>Great,&lt;BR /&gt;Use 0 and beginning&lt;BR /&gt;last_WED=intnx('week.4',date,0,'b');</description>
      <pubDate>Tue, 02 Jan 2024 13:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Last-Wednesday-AND-Last-Thursday-that-is-before-Last-Wednesday/m-p/910074#M358938</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-01-02T13:08:58Z</dc:date>
    </item>
  </channel>
</rss>

