<?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: INTNX function - find saturday on the same week in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789946#M252868</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503"&gt;@AlexeyS&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;saturday=intnx('week', date, 1)-1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Or, slightly shorter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;saturday=date+7-weekday(date);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2022 11:23:42 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2022-01-13T11:23:42Z</dc:date>
    <item>
      <title>INTNX function - find saturday on the same week</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789941#M252866</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For each date, i want to find the saturday date on the same week. But if the date is Sunday then the function have to return the next Saturday.&lt;/P&gt;&lt;P&gt;I use the following code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;saturday = intnx('week.7', date, 1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This works as long as it is not about the Saturday itself. In this case, it returns the next Saturday. Please help.&lt;/P&gt;&lt;P&gt;How the function should work :&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;saturday&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/01/2022&lt;/TD&gt;&lt;TD&gt;15/01/2022&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/01/2022&lt;/TD&gt;&lt;TD&gt;15/01/2022&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16/01/2022&lt;/TD&gt;&lt;TD&gt;22/01/2022&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Alexey&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 11:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789941#M252866</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2022-01-13T11:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function - find saturday on the same week</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789946#M252868</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42503"&gt;@AlexeyS&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;saturday=intnx('week', date, 1)-1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Or, slightly shorter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;saturday=date+7-weekday(date);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 11:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789946#M252868</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-01-13T11:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function - find saturday on the same week</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789947#M252869</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date ddmmyy10.;
format date ddmmyy10.;
datalines;
12/01/2022 
15/01/2022 
16/01/2022 
;

data want;
   set have;
   saturday = intnx('week', date, 0, 'e');
   format saturday ddmmyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jan 2022 11:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-find-saturday-on-the-same-week/m-p/789947#M252869</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-01-13T11:12:35Z</dc:date>
    </item>
  </channel>
</rss>

