<?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 function (is it possible to not round number and display decimal?) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47615#M12799</link>
    <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
I have found the yrdif() function.  This provides a decimal format.  Thanks for your help.&lt;BR /&gt;
&lt;BR /&gt;
Lori</description>
    <pubDate>Tue, 26 Jan 2010 19:07:48 GMT</pubDate>
    <dc:creator>LAtwood</dc:creator>
    <dc:date>2010-01-26T19:07:48Z</dc:date>
    <item>
      <title>Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47608#M12792</link>
      <description>I am trying to calculate the number of months between to SAS date values using the intck function.  However, I do not want the end result to be rounded.  For example instead of 33.0 I would like to see 32.967.  Is there another function I could use to get this result?  Any help with this would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 26 Jan 2010 16:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47608#M12792</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T16:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47609#M12793</link>
      <description>What type of SAS variable(s) or constants are you using with INTCK - share code, ideally?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 26 Jan 2010 17:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47609#M12793</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-26T17:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47610#M12794</link>
      <description>Scott here's the code I'm working with.  yrs_service is the calculation - Ideally I would like to display a decimal format&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE SASUSER.QUERY_FOR_PENSION_MSTR_0006 AS SELECT DISTINCT (intck('month',PENSION_MSTR.hire_dt ,(input(substr("&amp;amp;retire_date",3,6),yymmdd.))) ) AS yrs_service &lt;BR /&gt;
 FROM PAY.PENSION_MSTR AS PENSION_MSTR&lt;BR /&gt;
 WHERE PENSION_MSTR.clock_num = "&amp;amp;clock_num";&lt;BR /&gt;
QUIT;</description>
      <pubDate>Tue, 26 Jan 2010 18:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47610#M12794</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T18:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47611#M12795</link>
      <description>Also if I got the right amoung of months I would then obviously divide by twelve to get the years.</description>
      <pubDate>Tue, 26 Jan 2010 18:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47611#M12795</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T18:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47612#M12796</link>
      <description>Also if I got the right amoung of months I would then obviously divide by twelve to get the years.</description>
      <pubDate>Tue, 26 Jan 2010 18:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47612#M12796</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T18:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47613#M12797</link>
      <description>You will need to demonstrate now SAS is returning a non-integer value from the INTCK function with MONTH as the first argument.  A SAS log with source and resolved macro variables revealed, such as adding:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MGEN SGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 26 Jan 2010 18:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47613#M12797</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-26T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47614#M12798</link>
      <description>1                                                          The SAS System                            13:05 Tuesday, January 26, 2010&lt;BR /&gt;
&lt;BR /&gt;
1          ;*';*";*/;quit;run;&lt;BR /&gt;
2          OPTIONS PAGENO=MIN;&lt;BR /&gt;
3          %LET _CLIENTTASKLABEL=%NRBQUOTE(Code1);&lt;BR /&gt;
4          %LET _EGTASKLABEL=%NRBQUOTE(Code1);&lt;BR /&gt;
5          %LET _CLIENTPROJECTNAME=%NRBQUOTE(D:\SASDM\TSSUser\tssl.adams\egpuser\Oracle\Pension_Plan.egp);&lt;BR /&gt;
6          %LET _SASPROGRAMFILE=;&lt;BR /&gt;
7          &lt;BR /&gt;
8          ODS _ALL_ CLOSE;&lt;BR /&gt;
NOTE: Some of your options or statements may not be supported with the Activex or Java series of devices.  Graph defaults for these &lt;BR /&gt;
      drivers may be different from other SAS/GRAPH device drivers.  For further information, please contact Technical Support.&lt;BR /&gt;
9          OPTIONS DEV=ACTIVEX;&lt;BR /&gt;
NOTE: Writing ODS PDF(EGPDF) output to TEMP destination "E:\SASWORK\_TD1804\#LN00023", printer "PDF".&lt;BR /&gt;
10         FILENAME EGPDF TEMP;&lt;BR /&gt;
11         ODS PDF(ID=EGPDF) FILE=EGPDF STYLE=printer SAS;&lt;BR /&gt;
SYMBOLGEN:  Macro variable SYSVLONG resolves to 9.01.01M3P020206&lt;BR /&gt;
SYMBOLGEN:  Macro variable GRAPHAVAIL resolves to 9.01 TS1M3&lt;BR /&gt;
12         &lt;BR /&gt;
13         %gaccessible;&lt;BR /&gt;
SYMBOLGEN:  Macro variable ACCESSIBLE resolves to ACCESSIBLE&lt;BR /&gt;
MPRINT(GACCESSIBLE):   GOPTIONS ACCESSIBLE;&lt;BR /&gt;
14         OPTIONS SOURCE SOURCE2 MGEN SGEN MPRINT;&lt;BR /&gt;
15         PROC SQL;&lt;BR /&gt;
16          CREATE TABLE SASUSER.QUERY_FOR_PENSION_MSTR_0007 AS SELECT DISTINCT (intck('month',&lt;BR /&gt;
17         	PENSION_MSTR.hire_dt ,&lt;BR /&gt;
18         	(input(substr("&amp;amp;retire_date",&lt;BR /&gt;
SYMBOLGEN:  Macro variable RETIRE_DATE resolves to 20100101&lt;BR /&gt;
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;
19         	3,&lt;BR /&gt;
20         	6),&lt;BR /&gt;
21         	yymmdd.))) ) AS yrs_service&lt;BR /&gt;
22          FROM PAY.PENSION_MSTR AS PENSION_MSTR&lt;BR /&gt;
23          WHERE PENSION_MSTR.clock_num = "&amp;amp;clock_num";&lt;BR /&gt;
SYMBOLGEN:  Macro variable CLOCK_NUM resolves to 65310&lt;BR /&gt;
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;
NOTE: Table SASUSER.QUERY_FOR_PENSION_MSTR_0007 created, with 1 rows and 1 columns.&lt;BR /&gt;
&lt;BR /&gt;
24         &lt;BR /&gt;
25         QUIT;&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           1.37 seconds&lt;BR /&gt;
      cpu time            0.06 seconds&lt;BR /&gt;
      &lt;BR /&gt;
&lt;BR /&gt;
26         &lt;BR /&gt;
27         %LET _CLIENTTASKLABEL=;&lt;BR /&gt;
28         %LET _EGTASKLABEL=;&lt;BR /&gt;
29         %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;
30         %LET _SASPROGRAMFILE=;&lt;BR /&gt;
31         &lt;BR /&gt;
32         ;*';*";*/;quit;run;&lt;BR /&gt;
33         ODS _ALL_ CLOSE;&lt;BR /&gt;
NOTE: ODS PDF(EGPDF) printed no output. &lt;BR /&gt;
      (This sometimes results from failing to place a RUN statement before the ODS PDF(EGPDF) CLOSE statement.)&lt;BR /&gt;
34         &lt;BR /&gt;
35         &lt;BR /&gt;
36         QUIT; RUN;&lt;BR /&gt;
37         &lt;BR /&gt;
&lt;BR /&gt;
Scott I am unsure where it states in the log the value from the INTCK function.  Or if it even displays it at all?</description>
      <pubDate>Tue, 26 Jan 2010 18:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47614#M12798</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T18:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47615#M12799</link>
      <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
I have found the yrdif() function.  This provides a decimal format.  Thanks for your help.&lt;BR /&gt;
&lt;BR /&gt;
Lori</description>
      <pubDate>Tue, 26 Jan 2010 19:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47615#M12799</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-26T19:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47616#M12800</link>
      <description>Lori,&lt;BR /&gt;
&lt;BR /&gt;
I think you've found out that the INTCK function only returns integer values.  This is because it counts period boundaries, and not durations.  For example:&lt;BR /&gt;
&lt;BR /&gt;
  INTCK('MONTH', '30Mar2009'd, '05May2009'd)&lt;BR /&gt;
      = INTCK('MONTH', '05Mar2009'd, '30May2009'd)&lt;BR /&gt;
      = 2&lt;BR /&gt;
&lt;BR /&gt;
because it has counted 2 month boundaries on 01Apr2009 and 01May2009 in each case.&lt;BR /&gt;
&lt;BR /&gt;
In the same way the INTNX function increments dates to the corresponding boundary date.  For example:&lt;BR /&gt;
&lt;BR /&gt;
  INTNX('MONTH', '05Mar2009'd, 2)&lt;BR /&gt;
      = INTNX('MONTH', '30Mar2009'd, 2)&lt;BR /&gt;
      = '01May2009'd&lt;BR /&gt;
&lt;BR /&gt;
Hope this clears up any confusion..........Phil</description>
      <pubDate>Thu, 28 Jan 2010 21:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47616#M12800</guid>
      <dc:creator>prholland</dc:creator>
      <dc:date>2010-01-28T21:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47617#M12801</link>
      <description>Lori&lt;BR /&gt;
 &lt;BR /&gt;
yrdif() is documented as serving a fairly narrow purpose. &lt;A href="http://support.sas.com/kb/36/977.html" target="_blank"&gt;http://support.sas.com/kb/36/977.html&lt;/A&gt; &lt;BR /&gt;
 &lt;BR /&gt;
 Would the simple calculation&lt;BR /&gt;
   ( PENSION_MSTR.hire_dt - "&amp;amp;retire_date"d  )  / 365.25 &lt;BR /&gt;
provide a logically correct number for "years with decimal fraction" ?</description>
      <pubDate>Thu, 28 Jan 2010 23:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47617#M12801</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-28T23:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47618#M12802</link>
      <description>A constant of 365.25 - divisor for computing "logically correct number of years"?  For real?  The appropriate function is INTCK.  Better to suggest the OP (Lori) treat the problem rather than attempting to circumvent or treat the perceived symptom which has not yet been confirmed.  Come on guys!&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 29 Jan 2010 00:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47618#M12802</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-29T00:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47619#M12803</link>
      <description>Scott,&lt;BR /&gt;
what are you offering the OP whose subject line seeks to avoid the ingeter result generated by the technique you suggest?</description>
      <pubDate>Fri, 29 Jan 2010 08:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47619#M12803</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-29T08:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47620#M12804</link>
      <description>Here is the code for an accurate decimal months interval calculation using SAS functions:&lt;BR /&gt;
&lt;BR /&gt;
1    data _null_;&lt;BR /&gt;
2    format s_dt l_dt l_dt_end date9.;&lt;BR /&gt;
3    s_dt = mdy(12,25,2008);&lt;BR /&gt;
4    l_dt = mdy(1,15,2010);&lt;BR /&gt;
5    months = intck('month',s_dt,l_dt);&lt;BR /&gt;
6    l_dt_end = intnx('month',l_dt,0,'e');&lt;BR /&gt;
7    dec_months =  months + (day(l_dt) / day(l_dt_end));&lt;BR /&gt;
8    putlog _all_;&lt;BR /&gt;
9    run;&lt;BR /&gt;
&lt;BR /&gt;
s_dt=25DEC2008 l_dt=15JAN2010 l_dt_end=31JAN2010 months=13 dec_months=13.483870968&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.04 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
TS-668 - SAS Dates, Times, and Interval Functions&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/technote/ts668.pdf" target="_blank"&gt;http://support.sas.com/techsup/technote/ts668.pdf&lt;/A&gt;</description>
      <pubDate>Fri, 29 Jan 2010 14:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47620#M12804</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-29T14:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47621#M12805</link>
      <description>Scott,&lt;BR /&gt;
how would you refine it for the case [pre]1646  data _null_;&lt;BR /&gt;
1647     format s_dt l_dt l_dt_end date9.;&lt;BR /&gt;
1648     s_dt = mdy(12,25,2008);&lt;BR /&gt;
1649     l_dt = mdy(12,25,2010);&lt;BR /&gt;
1650     months = intck('month',s_dt,l_dt);&lt;BR /&gt;
1651     l_dt_end = intnx('month',l_dt,0,'e');&lt;BR /&gt;
1652     dec_months =  months + (day(l_dt) / day(l_dt_end));&lt;BR /&gt;
1653     putlog _all_;&lt;BR /&gt;
1654  run;&lt;BR /&gt;
&lt;BR /&gt;
s_dt=25DEC2008 l_dt=25DEC2010 l_dt_end=31DEC2010 months=24 dec_months=24.806451613 _ERROR_=0 _N_=1&lt;BR /&gt;
NOTE: DATA statement used[/pre] where I think the dec_months should result in 24 rather than  dec_months=24.806451613</description>
      <pubDate>Fri, 29 Jan 2010 14:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47621#M12805</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-29T14:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47622#M12806</link>
      <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
The month difference should be closer to 12.6 than 13.4.  I think the yrdif function still gets me closer to the figure I need.  When I calculate using the yrdif function I get 12.6. I understand there still is a discrepancy with the yrdif function but unless there are no other options with intck to get a decimal the yrdif might be my only option.&lt;BR /&gt;
&lt;BR /&gt;
From 12-25-08 to 12-25-09 is one year difference.  6 days left in december, and 15 days in january the following year, add up to 21 days.  Divide 21 by 31 days will give you .677.  So one year plus .677 will give you 12.677.  So how do you get 13.4?</description>
      <pubDate>Fri, 29 Jan 2010 15:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47622#M12806</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-29T15:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47623#M12807</link>
      <description>SAS made the calculation - not me -- you will need to take it from here.  Suggest you follow the SAS function logic in the DOC, then adapt your increment/decrement choice based on SAS-generated results.  My expectation is that you will see consistency using the function, but it's your choice to go up or down, as desired, with your SAS application needs.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 29 Jan 2010 15:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47623#M12807</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-29T15:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47624#M12808</link>
      <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help and input on this.  I appreciate it.&lt;BR /&gt;
&lt;BR /&gt;
Lori</description>
      <pubDate>Fri, 29 Jan 2010 15:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47624#M12808</guid>
      <dc:creator>LAtwood</dc:creator>
      <dc:date>2010-01-29T15:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Intck function (is it possible to not round number and display decimal?)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47625#M12809</link>
      <description>Hi:&lt;BR /&gt;
  Using either a modified version of Scott's method or a modified version of Peter's method, it is possible to either come CLOSE to your 12.6 or exactly hit your 12.677. See the attached modified program and log output. If all you wanted was the 12.6, then either of the modified methods will give you that number. If you want -exactly- 12.677...&lt;BR /&gt;
  &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
467  data _null_;&lt;BR /&gt;
468    format s_dt l_dt l_dt_end s_dt_end l_dt_beg date9.;&lt;BR /&gt;
469    s_dt = mdy(12,25,2008);&lt;BR /&gt;
470    l_dt = mdy(1,15,2010);&lt;BR /&gt;
471&lt;BR /&gt;
472    ** Scott B Original Calc;&lt;BR /&gt;
473    months = intck('month',s_dt,l_dt);&lt;BR /&gt;
474    l_dt_end = intnx('month',l_dt,0,'e');&lt;BR /&gt;
475    dec_month_sb_orig = months + day(l_dt) / day(l_dt_end);&lt;BR /&gt;
476&lt;BR /&gt;
477    ** Peter C. Suggestion Modified;&lt;BR /&gt;
478    dec_months_pc = (l_dt - s_dt) /(365.25/12);&lt;BR /&gt;
479&lt;BR /&gt;
480    ** get the END of the start date and the BEGIN of the Last date;&lt;BR /&gt;
481    s_dt_end = intnx('month',s_dt,0,'e');&lt;BR /&gt;
482    l_dt_beg = intnx('month',l_dt,0,'b');&lt;BR /&gt;
483&lt;BR /&gt;
484    ** because INTCK returns whole intervals, subtract 1 day from the;&lt;BR /&gt;
485    ** beginning of the last date -- this will give you 12 months instead of 13;&lt;BR /&gt;
486    newmonth = intck('month',s_dt,l_dt_beg-1);&lt;BR /&gt;
487&lt;BR /&gt;
488    ** Now, figure out how many days from the start day to the end of the start month;&lt;BR /&gt;
489    ** and the number of days in the last date;&lt;BR /&gt;
490    daysleft = (s_dt_end -s_dt) + day(l_dt);&lt;BR /&gt;
491&lt;BR /&gt;
492    ** Do the modified formula using DAYSLEFT and NEWMONTH;&lt;BR /&gt;
493    dec_month_sb_alt =  newmonth + (daysleft / day(l_dt_end));&lt;BR /&gt;
494&lt;BR /&gt;
495    putlog s_dt= s_dt_end= l_dt= l_dt_beg= l_dt_end=;&lt;BR /&gt;
496    putlog '***** ***** ***** *****';&lt;BR /&gt;
497    putlog "Scott Original Calc:";&lt;BR /&gt;
498    putlog dec_month_sb_orig=;&lt;BR /&gt;
499    putlog '***** ***** ***** *****';&lt;BR /&gt;
500    putlog "Peter Suggestion Modified";&lt;BR /&gt;
501    putlog dec_months_pc=;&lt;BR /&gt;
502    putlog '***** ***** ***** *****';&lt;BR /&gt;
503    putlog "Using DAYSLEFT by modifying Scott's Original Calc";&lt;BR /&gt;
504    putlog daysleft= newmonth= dec_month_sb_alt=;&lt;BR /&gt;
505  run;&lt;BR /&gt;
                           &lt;BR /&gt;
s_dt=25DEC2008 s_dt_end=31DEC2008 l_dt=15JAN2010 l_dt_beg=01JAN2010 l_dt_end=31JAN2010&lt;BR /&gt;
***** ***** ***** *****&lt;BR /&gt;
Scott Original Calc:&lt;BR /&gt;
dec_month_sb_orig=13.483870968&lt;BR /&gt;
***** ***** ***** *****&lt;BR /&gt;
Peter Suggestion Modified&lt;BR /&gt;
dec_months_pc=12.681724846&lt;BR /&gt;
***** ***** ***** *****&lt;BR /&gt;
Using DAYSLEFT by modifying Scott's Original Calc&lt;BR /&gt;
daysleft=21 newmonth=12 dec_month_sb_alt=12.677419355&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
                               &lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 29 Jan 2010 16:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Intck-function-is-it-possible-to-not-round-number-and-display/m-p/47625#M12809</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-01-29T16:54:32Z</dc:date>
    </item>
  </channel>
</rss>

