<?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: Using 'day' interval in intnx and intck in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360346#M84824</link>
    <description>Yeah, but that's so much of an edge case it's fallen off the side of the planet. I take your point, but I'm not buying it. &lt;BR /&gt;&lt;BR /&gt;I'd much rather keep things simple. &lt;BR /&gt;</description>
    <pubDate>Mon, 22 May 2017 00:41:32 GMT</pubDate>
    <dc:creator>LaurieF</dc:creator>
    <dc:date>2017-05-22T00:41:32Z</dc:date>
    <item>
      <title>Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360343#M84821</link>
      <description>Can someone explain why anyone would use 'day' as an interval parameter, since day is ipso facto the granular date? Code example: "intnx('day', todaydate, -200)" cf "todaydate - 200".&lt;BR /&gt;&lt;BR /&gt;I'm flummoxed.</description>
      <pubDate>Mon, 22 May 2017 00:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360343#M84821</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-05-22T00:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360345#M84823</link>
      <description>&lt;P&gt;If it was some type of dynamic calculation where the parameters were user defined. Then one formula could be used to be generic. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 00:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360345#M84823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-22T00:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360346#M84824</link>
      <description>Yeah, but that's so much of an edge case it's fallen off the side of the planet. I take your point, but I'm not buying it. &lt;BR /&gt;&lt;BR /&gt;I'd much rather keep things simple. &lt;BR /&gt;</description>
      <pubDate>Mon, 22 May 2017 00:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360346#M84824</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-05-22T00:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360347#M84825</link>
      <description>&lt;P&gt;Another viewpoint then, if you were developing the function would you have excluded day as an option?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 00:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360347#M84825</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-22T00:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360348#M84826</link>
      <description>&lt;P&gt;I actually am not a fan of the month interval personally because it's not a standard measure. It makes things easier for people to understand but from a comparison or duration perspective it's not a good metric.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For calculating number of days, I would use basic math operations as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 00:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360348#M84826</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-22T00:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360349#M84827</link>
      <description>&lt;P&gt;Since one can include multiples and shift indexes with any interval, it can simplify coding when they're needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that yes, I too, typically only do the math when I need to increase or decrease dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 00:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360349#M84827</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-22T00:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360353#M84830</link>
      <description>&lt;P&gt;1- As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; mentionned, if the &lt;EM&gt;day&lt;/EM&gt; measure wasn't there, there would be a gap and some people would (rightfully) ask where on earth it is.&lt;/P&gt;
&lt;P&gt;2- As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; mentionned, multiples and shift indexes are so very powerful&lt;BR /&gt;3- and it can all be programmatically driven (as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; also mentionned)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; a=intnx('day2', '01jan2010'd, 10); put a= date9.; %*  Add ten 2-day periods;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;a=20JAN2010&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 04:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360353#M84830</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-05-22T04:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360364#M84833</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17429"&gt;@LaurieF&lt;/a&gt; wrote:&lt;BR /&gt;Yeah, but that's so much of an edge case it's fallen off the side of the planet. I take your point, but I'm not buying it. &lt;BR /&gt;&lt;BR /&gt;I'd much rather keep things simple. &lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then your planet is awfully small. Consider reclassifying it as an asteroid.&lt;/P&gt;
&lt;P&gt;Just think of a stored process where a timespan can be dynamically entered as a combination of (prompt A) multiples and (prompt B) intervals, where one of the intervals might be days. Then you would have to use extra code for days if the intnx didn't support that.&lt;/P&gt;
&lt;P&gt;And that would be REAL stupidity squared.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 06:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360364#M84833</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-22T06:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360368#M84835</link>
      <description>&lt;P&gt;D--n, that was harsh. And unncessary. Please don't try to teach grandpa how to suck eggs. I am very well aware of these, but that was&amp;nbsp;&lt;EM&gt;not&lt;/EM&gt; the point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It&amp;nbsp;&lt;EM&gt;is&lt;/EM&gt; an edge case. The code I showed was base SAS code (contained within a DI user-written transformation) and it was exactly as I wrote it (on my phone). It wasn't part of a drop-down selection, it wasn't "DAY.2" or anything fancy like that. I accept that these are reasonable responses to my mini-rant that started off, but they are the &lt;EM&gt;exception&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I come across this usage of&amp;nbsp;&lt;EM&gt;intnx&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;intck&lt;/EM&gt; in virtually every site I work at, and it annoys me greatly. It makes the maintenance of the code harder, and it also makes it harder to read. It also shows a probable lack of understanding by whoever wrote the code of how SAS dates inherently work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is of course a requirement of the&amp;nbsp;&lt;EM&gt;intxx&lt;/EM&gt; functions to accept 'day'. It doesn't mean that people should use it.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 07:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360368#M84835</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-05-22T07:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360369#M84836</link>
      <description>&lt;P&gt;No, I would of course include it. If I were master of the universe, I'd make the (pseudo-)code have a select for 'day' and use the arithmetic approach - if that isn't how it's done already.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I would also update the documentation to recommend for single day calculations to do it without the functions.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 07:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360369#M84836</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-05-22T07:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360375#M84839</link>
      <description>&lt;P&gt;I may have misunderstood your rant (and one follow-up post) as being against the &lt;EM&gt;presence&lt;/EM&gt; of the day interval vs. being against the (unreflected) &lt;EM&gt;use&lt;/EM&gt; of it. Apologies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the use of the function can make sense in view of other aspects:&lt;/P&gt;
&lt;P&gt;- it disconnects the logical calculation from the physical calculation. This helps in porting code to other systems that may do dates differently, but have similar functions&lt;/P&gt;
&lt;P&gt;- it hardens against any change in how SAS deals with variables (which is, of course, unlikely to the extreme)&lt;/P&gt;
&lt;P&gt;- it helps in preparing against type changes (date to datetime happens often in databases, and it has happened with our so-beloved Excel); one can then keep the code and needs to only replace 'day' with 'dtday', which &lt;EM&gt;may&lt;/EM&gt; help in automated changes to a codebase.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I am with you that in &amp;gt;90% of cases it is proper to use a simple addition/subtraction instead of intnx when dates and days are involved. Both in terms of KISS and performance.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 08:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360375#M84839</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-22T08:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360388#M84843</link>
      <description>&lt;P&gt;First point - most other systems &lt;EM&gt;I've&lt;/EM&gt; used use a base-dating system, whether it be 1Jan1960, 1Jan1901 or similar, and allow day arithmetic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second point - won't happen. All of SAS's date handling would break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third point - shrug. Except for day multiples ('day.2' et al) (and I've never personally had a reason to use them), I'll keep on using arithmetic, and counselling and training for its use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I saw:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intck('month', intnx('month', startdte, 0, 'b'), intnx('month', endte, 0, 'b'))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intck('month', startdte, endte)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is possible to argue that there may be a reason to use the former, for possible later modification. I would wager a reasonable amount of beer that that time will never come.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make it as simple as possible, but no simpler.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 09:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360388#M84843</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-05-22T09:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using 'day' interval in intnx and intck</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360452#M84869</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17429"&gt;@LaurieF&lt;/a&gt; wrote:&lt;BR /&gt;Yeah, but that's so much of an edge case it's fallen off the side of the planet. I take your point, but I'm not buying it. &lt;BR /&gt;&lt;BR /&gt;I'd much rather keep things simple. &lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Day&amp;nbsp;would be the base of the Day2, Day3, Day4, Dayx intervals&lt;/P&gt;
&lt;P&gt;Not to mention the DtDay.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An I believe it does "keep things simple". Without out the Day (or eqivalent Second for time/datetime) you would NOT be able to have exactly parallel code but would have to conditionally substitute subtraction or addition.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 14:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-day-interval-in-intnx-and-intck/m-p/360452#M84869</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-22T14:37:20Z</dc:date>
    </item>
  </channel>
</rss>

