<?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: INTCK and dates with DEC 31 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564687#M158416</link>
    <description>&lt;P&gt;What is your desired result here?&lt;/P&gt;</description>
    <pubDate>Sat, 08 Jun 2019 19:19:27 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-06-08T19:19:27Z</dc:date>
    <item>
      <title>INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564686#M158415</link>
      <description>&lt;P&gt;Dear SAS experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to recreate a SURV_MM variable in the gold-standard dataset. INTCK function created identical values except for the dates with DEC 31. Desired result is the SURV_MM and N_MONTH is what I ended up with INTCK function as coded below. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="post_it.png" style="width: 437px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30130i5205B6F81B9A6B58/image-size/large?v=v2&amp;amp;px=999" role="button" title="post_it.png" alt="post_it.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how to recreate SURV_MM for the dates with DEC31 that INTCK function appeared to produce a result by one month off?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE;
INPUT DX EXIT SURV_MM;
CARDS;
6002 13148  233.5 
10019 13148 101.5
10750 13148 77.5 
11480 13148 53.5 
11846 13148 41.5 
10385 13148 89.5 
;
RUN; 

DATA HAVE1; SET HAVE;
N_MONTH=0.5+intck('month',dx,exit);
CHECK_MO=N_MONTH-SURV_MM;
RUN;
PROC PRINT DATA=HAVE1;
FORMAT DX EXIT DATE9.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 19:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564686#M158415</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T19:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564687#M158416</link>
      <description>&lt;P&gt;What is your desired result here?&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 19:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564687#M158416</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-08T19:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564688#M158417</link>
      <description>SURV_MM. thanks for asking!</description>
      <pubDate>Sat, 08 Jun 2019 19:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564688#M158417</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T19:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564689#M158418</link>
      <description>&lt;P&gt;INTCK counts the number of BOUNDARIES crossed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last day of December is just BEFORE the boundary into January.&amp;nbsp; Why are you only checking last day of December.&amp;nbsp; Do you have any dates that are the last day of other months?&lt;/P&gt;
&lt;P&gt;What formula was used to create the number you are comparing to?&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 19:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564689#M158418</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-08T19:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564690#M158419</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are you only checking last day of December. Do you have any dates that are the last day of other months?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Yes, there are other cases. Please see my full SAS code below. INTCK function did the job except for these 6 cases. I'm trying to recreate SURV_MM and SURV_YY in the colon.colon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What formula was used to create the number you are comparing to?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will check in the Dickman's directory where he might have showed how SURV_MM and SURV_YY were created. Thanks for asking this. Maybe he showed else where in one of sub folders.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*COLON.SAS7BDAT CAN BE FOUND IN THIS LINK http://www.pauldickman.com/survival/?dir=sas*/
/*THIS IS MY ATTEMPT TO RECREATE SURV_MM AND SURV_YY*/
DATA COLON; /*N=15,564*/ SET Colon.colon(DROP=status subsite year8594 agegrp ); /*N=15,564*/
id=_n_; 
n_mo=0.5+intck('month',dx,exit);
n_yy=0.5+int(yrdif(dx,exit,'actual'));
check_mo=n_mo-surv_mm; /*CHECK_MO=1 FOR 6 CASES*/
check_yy=n_yy-surv_yy; /*CHECK_YY=0 FOR ALL CASES*/
RUN;

proc freq data=colon;
tables check_mo check_yy;
run;

PROC PRINT DATA=COLON;
WHERE CHECK_MO=1;
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 19:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564690#M158419</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T19:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564693#M158420</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; I couldn't find .sas file in Dickman's directory where he showed how SURV_MM and SURv_YY were created.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.pauldickman.com/survival/?dir=sas" target="_blank"&gt;http://www.pauldickman.com/survival/?dir=sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below is the screenshot again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TOM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30131iE7B145D2B1A18D9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="TOM.png" alt="TOM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 20:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564693#M158420</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T20:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564706#M158422</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Analyzing the source data with code below it appears that the same values for DX and EXIT not always result in the same value for SURV_MM.&lt;/P&gt;
&lt;P&gt;There is either a glitch in the data or there must be an additional bit of logic for calculating SURV_MM.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select dx, exit, surv_mm, count(surv_mm) as surv_mm_cnt
  from
    (
      select dx, exit, surv_mm
      from source.colon
      group by dx, exit
      having count(distinct surv_mm)&amp;gt;1
    )
  group by dx, exit, surv_mm
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 470px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30135iC52E8A1F014D4479/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 23:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564706#M158422</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-08T23:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564707#M158423</link>
      <description>&lt;P&gt;Yeah it looks like they are just errors in the data.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 23:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564707#M158423</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-08T23:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564709#M158424</link>
      <description>&lt;P&gt;They stated "underlying time unit is now days we specify scale=365.25 to transform to years" in the page 8 of the documention below. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.pauldickman.com/survival/sas/relative_survival_using_sas.pdf" target="_blank"&gt;http://www.pauldickman.com/survival/sas/relative_survival_using_sas.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would this explain "additional logic" &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt; pointed out? &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 23:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564709#M158424</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T23:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564711#M158425</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It indicates that they didn't use INTCK() but just used 365.25 days in a formula. That's normally only the 2nd best option. INTCK() also gets it right with leap years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It doesn't explain why the result can be different for the exactly same start and end date.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 23:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564711#M158425</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-08T23:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564712#M158426</link>
      <description>Thank you. I'll use 365.25 and take integer of the resulting decimals and compare.</description>
      <pubDate>Sat, 08 Jun 2019 23:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564712#M158426</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-08T23:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564713#M158427</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you. I'll use 365.25 and take integer of the resulting decimals and compare.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That won't lead to a different outcome. In the source data there are different month counts for the exactly same start and end date. It looks very much like this is simply a DQ issue.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 23:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564713#M158427</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-08T23:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK and dates with DEC 31</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564714#M158428</link>
      <description>I see. Thanks for the pointer.</description>
      <pubDate>Sun, 09 Jun 2019 00:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-and-dates-with-DEC-31/m-p/564714#M158428</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-09T00:11:25Z</dc:date>
    </item>
  </channel>
</rss>

