<?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: Day Count in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853109#M337220</link>
    <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/leforinforref/n0pxq4af0hx60nn1i1x3xn41mc3c.htm#n0zn1re74n6pfvn170g9us41coho" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmmvacdc/9.4/leforinforref/n0pxq4af0hx60nn1i1x3xn41mc3c.htm#n0zn1re74n6pfvn170g9us41coho&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 17:28:45 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-01-10T17:28:45Z</dc:date>
    <item>
      <title>Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805857#M317458</link>
      <description>&lt;P&gt;Hello! Hope all is well!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've run the code below and did not get the correct result for 'Saturday'.&amp;nbsp; For the period of Jan 1, 2022 to March 31, 2022 I only get 12 instead of 13.&amp;nbsp; Does any one know what if there is an error with my code? thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;%let startdate = 1Jan2022;&lt;BR /&gt;%let enddate = 31Mar2022;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Weekdays;&lt;BR /&gt;Sunday = intck('weekday234567W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Monday = intck('weekday134567W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Tuesday = intck('weekday124567W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Wednesday = intck('weekday123567W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Thursday = intck('weekday123467W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Friday = intck('weekday123457W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;Saturday = intck('weekday123456W',"&amp;amp;startdate"d,"&amp;amp;enddate"d);&lt;BR /&gt;put _all_;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is the data I got:&lt;/P&gt;
&lt;TABLE width="416"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="52"&gt;Sunday&lt;/TD&gt;
&lt;TD width="57"&gt;Monday&lt;/TD&gt;
&lt;TD width="58"&gt;Tuesday&lt;/TD&gt;
&lt;TD width="80"&gt;Wednesday&lt;/TD&gt;
&lt;TD width="63"&gt;Thursday&lt;/TD&gt;
&lt;TD width="45"&gt;Friday&lt;/TD&gt;
&lt;TD width="61"&gt;Saturday&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;12&lt;/TD&gt;
&lt;TD&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805857#M317458</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2022-04-04T14:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805864#M317461</link>
      <description>&lt;P&gt;Just count how many Saturdays are &lt;U&gt;between&lt;/U&gt; the startdate and enddate. This year, there are 12.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805864#M317461</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-04T14:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805885#M317469</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;points out the &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_self"&gt;INTCK function&lt;/A&gt; counts between the dates, and Jan 1st was a Saturday in 2022 and hence is not counted&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Returns the number of interval boundaries of a given kind that lie between two dates, times, or datetime values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 04 Apr 2022 16:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805885#M317469</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2022-04-04T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805894#M317476</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621"&gt;@Eugenio211&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wouldn't it be easier to use shifted &lt;EM&gt;week&lt;/EM&gt; intervals?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Weekdays;
Sunday    = intck('week.1',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Monday    = intck('week.2',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Tuesday   = intck('week.3',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Wednesday = intck('week.4',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Thursday  = intck('week.5',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Friday    = intck('week.6',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
Saturday  = intck('week.7',"&amp;amp;startdate"d-1,"&amp;amp;enddate"d);
put (_all_)(=);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;With the inserted "&lt;FONT face="courier new,courier"&gt;-1&lt;/FONT&gt;" the interval boundary before the start date is taken into account.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 17:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/805894#M317476</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-04-04T17:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853104#M337218</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;, I like this solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you say a little more about the 'Week.1' - 'Week.7' arguments. I guess Week.1 is equivalent to&amp;nbsp;weekday234567W. I can't find either in the documentation -- just curious how you know to use these.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853104#M337218</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2023-01-10T17:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853109#M337220</link>
      <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/leforinforref/n0pxq4af0hx60nn1i1x3xn41mc3c.htm#n0zn1re74n6pfvn170g9us41coho" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmmvacdc/9.4/leforinforref/n0pxq4af0hx60nn1i1x3xn41mc3c.htm#n0zn1re74n6pfvn170g9us41coho&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853109#M337220</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-10T17:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Day Count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853119#M337221</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7900"&gt;@SAShole&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's another documentation link:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0syn64amroombn14vrdzksh459w.htm#n1wbckrlffgb8jn15eebgjpqm23c" target="_blank" rel="noopener"&gt;Incrementing Dates and Times by Using Multipliers and By Shifting Intervals&lt;/A&gt;. The subsequent section "Commonly Used Time Intervals" includes the example&amp;nbsp;&lt;/P&gt;
&lt;TABLE id="p1ts3pusnedbi7n1v1tuzg8tmfp1" class="xisDoc-table"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xisDoc-horizontalLeft xisDoc-verticalTop"&gt;
&lt;P class="xisDoc-paragraph"&gt;WEEK.2&lt;/P&gt;
&lt;/TD&gt;
&lt;TD class="xisDoc-horizontalLeft xisDoc-verticalTop"&gt;
&lt;P class="xisDoc-paragraph"&gt;Weekly intervals starting on Mondays&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7900"&gt;@SAShole&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I guess Week.1 is equivalent to&amp;nbsp;weekday234567W.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, I think this is true, but it's also equivalent to the plain&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Week&lt;/FONT&gt;&amp;nbsp;interval without a shift index. The &lt;FONT face="courier new,courier"&gt;Weekday&lt;/FONT&gt; interval can be a bit &lt;A href="https://communities.sas.com/t5/SAS-Programming/INTNX-Weekday-Function-Issue/m-p/799915/highlight/true#M314590" target="_blank" rel="noopener"&gt;tricky to understand&lt;/A&gt; at times, so the &lt;FONT face="courier new,courier"&gt;Week.&lt;EM&gt;i&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;intervals seemed more intuitive to me for&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621" target="_blank" rel="noopener"&gt;Eugenio211&lt;/A&gt;'s task.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 18:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Day-Count/m-p/853119#M337221</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-01-10T18:31:41Z</dc:date>
    </item>
  </channel>
</rss>

