<?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: Question on SAS dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768347#M243713</link>
    <description>Yes, I agree with you, before I posted the question I had to read more on INTCK, but still 12.2857 seems to be greater as compared to 12.</description>
    <pubDate>Fri, 17 Sep 2021 18:54:12 GMT</pubDate>
    <dc:creator>himself</dc:creator>
    <dc:date>2021-09-17T18:54:12Z</dc:date>
    <item>
      <title>Calculating weeks from dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/767950#M243524</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a quick question on SAS dates, just wondering which one to use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
y='22jun2015'd;
z='16sep2015'd;

weeks=(z-y)/7;
weeksfn=intck('week',y,z);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So Assuming we have this type of question According to the SAP the following should be used to categorize time in weeks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so for weeks we have 12.285714286&lt;/P&gt;
&lt;P&gt;while weeksfn we have 12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAP says&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The time intervals will be defined as:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;‘0 – 12 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;’&amp;gt;12 – 26 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;‘&amp;gt; 26 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;So will this be categorized under 0-12 as per the intck function&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or it will be categorized as &amp;gt;12-26 weeks as per long division?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 07:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/767950#M243524</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2021-09-20T07:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Question on SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/767951#M243525</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a quick question on SAS dates, just wondering which one to use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
y='22jun2015'd;
z='16sep2015'd;

weeks=(z-y)/7;
weeksfn=intck('week',y,z);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So Assuming we have this type of question According to the SAP the following should be used to categorize time in weeks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so for weeks we have 12.285714286&lt;/P&gt;
&lt;P&gt;while weeksfn we have 12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAP says&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The time intervals will be defined as:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;‘0 – 12 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;’&amp;gt;12 – 26 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;‘&amp;gt; 26 weeks’ &lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;So will this be categorized under 0-12 as per the intck function&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or it will be categorized as &amp;gt;12-26 weeks as per long division?&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is completely up to you. In your program, you can handle either way, based upon your needs.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 17:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/767951#M243525</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-15T17:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Question on SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768004#M243551</link>
      <description>&lt;P&gt;Why are you complicating matters?&amp;nbsp; Don't even compute weeks.&amp;nbsp; Just use the number of days.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length interval $ 15;
if z-y &amp;lt; 84 then interval = '0 - 12 weeks';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Details to watch for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Should you include both the start points and end point in your interval, or just one of them?&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Do interval definitions require &amp;lt;&amp;nbsp; vs.&amp;nbsp; &amp;lt;=&amp;nbsp; ?&lt;/LI&gt;
&lt;LI&gt;Could either z or x take on a missing value?&amp;nbsp; Those could get assigned to the lowest interval, probably not a good result.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Regardless of the details, all of your requirements can be fulfilled using days, without calculating weeks.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 20:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768004#M243551</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-15T20:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Question on SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768016#M243558</link>
      <description>&lt;P&gt;Just base your categories on number of days.&amp;nbsp; You can label them using the text from the SAP, but use the actual number of days in the calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should also learn about the extra option to INTCK() that lets you control how it counts intervals.&amp;nbsp; The default is count the number of inter boundaries crossed.&amp;nbsp; So how many Sundays are in between the two dates.&amp;nbsp; But if you use CONT for the final option it will use the actual day of the week at the start of the interval when determining the number of intervals. So that should be more like your division by 7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
  input (y z) (:date.);
  format y z date9.;
  days = z-y;
  weeks1 = days/7;
  weeks2 = intck('week',y,z);
  weeks3 = intck('week',y,z,'cont');
cards;
22jun2015 16sep2015
01jan2021 01mar2021
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs            y            z    days     weeks1    weeks2    weeks3

 1     22JUN2015    16SEP2015     86     12.2857      12        12
 2     01JAN2021    01MAR2021     59      8.4286       9         8
&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Sep 2021 01:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768016#M243558</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-16T01:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Question on SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768347#M243713</link>
      <description>Yes, I agree with you, before I posted the question I had to read more on INTCK, but still 12.2857 seems to be greater as compared to 12.</description>
      <pubDate>Fri, 17 Sep 2021 18:54:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768347#M243713</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2021-09-17T18:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Question on SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768411#M243737</link>
      <description>&lt;P&gt;If you only want integer results, use the FLOOR function.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 06:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-weeks-from-dates/m-p/768411#M243737</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-18T06:24:31Z</dc:date>
    </item>
  </channel>
</rss>

