<?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 does not work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832345#M328973</link>
    <description>&lt;P&gt;Not valid date literals. You need to have the D to make SAS use the value as date. Otherwise it is a character value and INTCK or any other function will treat it as such causing errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%LET START_DATE = '07-SEP-2022'D;
%LET END_DATE = '07-SEP-2022'D;

DATA _NULL_;
   DAYS_DIFF = INTCK('DAY', &amp;amp;START_DATE, &amp;amp;END_DATE);
   put days_diff=;
RUN;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Sep 2022 16:10:40 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-09-08T16:10:40Z</dc:date>
    <item>
      <title>INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832341#M328971</link>
      <description>&lt;P&gt;I was wondering if someone can help me with the following query. It does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET START_DATE = '07-SEP-2022';&lt;BR /&gt;%LET END_DATE = '07-SEP-2022';&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;DAYS_DIFF = INTCK('DAY', &amp;amp;START_DATE, &amp;amp;END_DATE);&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;-7805904:*** -7805903:***&lt;BR /&gt;NOTE: Invalid numeric data, '07-SEP-2022' , at line -7805904 column ***.&lt;BR /&gt;NOTE: Invalid numeric data, '07-SEP-2022' , at line -7805903 column ***.&lt;BR /&gt;DAYS_DIFF=. _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;1 at -7805905:***&lt;BR /&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 15:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832341#M328971</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2022-09-08T15:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832344#M328972</link>
      <description>&lt;P&gt;Date literals in SAS are in the DATE9 format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET START_DATE = '07SEP2022'd;
%LET END_DATE = '07SEP2022'd;

DATA _NULL_;
DAYS_DIFF = INTCK('DAY', &amp;amp;START_DATE, &amp;amp;END_DATE);
DAYS_DIFF2 = &amp;amp;end_date - start_date;
put Days_Diff Days_DIff2;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832344#M328972</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-09-08T16:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832345#M328973</link>
      <description>&lt;P&gt;Not valid date literals. You need to have the D to make SAS use the value as date. Otherwise it is a character value and INTCK or any other function will treat it as such causing errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%LET START_DATE = '07-SEP-2022'D;
%LET END_DATE = '07-SEP-2022'D;

DATA _NULL_;
   DAYS_DIFF = INTCK('DAY', &amp;amp;START_DATE, &amp;amp;END_DATE);
   put days_diff=;
RUN;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832345#M328973</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-08T16:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832348#M328976</link>
      <description>&lt;P&gt;Thanks but I need to keep my macro variables untouched because I use them in the rest of my code and they need to be expressed as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET START_DATE = '07-SEP-2022';&lt;BR /&gt;%LET END_DATE = '07-SEP-2022';&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832348#M328976</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2022-09-08T16:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832349#M328977</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;

DAYS_DIFF = INTCK('DAY', input(&amp;amp;START_DATE, date11.), input(&amp;amp;END_DATE, date11.));
PUT DAYS_DIFF;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832349#M328977</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-09-08T16:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832350#M328978</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/314145"&gt;@Emoji&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks but I need to keep my macro variables untouched because I use them in the rest of my code and they need to be expressed as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%LET START_DATE = '07-SEP-2022';&lt;BR /&gt;%LET END_DATE = '07-SEP-2022';&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So to use INTCK() you need to convert those quoted strings into actual date values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since those values are in a style that the DATE informat can understand and already have quotes around them all you need to do is add the letter D after each to make them into something SAS will see as a date value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  months = intck('month',&amp;amp;start_date.d,&amp;amp;end_date.d);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you had some other style then you would need to use the INPUT() function to convert those strings into dates, as long as the style of the strings is something understood by a SAS informat.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET START_DATE = '2022-09-07';
data _null_;
  date = input(&amp;amp;start_date,yymmdd10.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832350#M328978</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-08T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832352#M328980</link>
      <description>&lt;P&gt;Thanks a lot. it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832352#M328980</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2022-09-08T16:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832354#M328981</link>
      <description>&lt;P&gt;Thank you for your help. it worked/&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTCK-does-not-work/m-p/832354#M328981</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2022-09-08T16:29:18Z</dc:date>
    </item>
  </channel>
</rss>

