<?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 + dates stored as macro variables = error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831817#M328766</link>
    <description>Many thanks @FreelanceReinhard&lt;BR /&gt;&lt;BR /&gt;As for the leading tab characters in the data step code - yes, they're there. I use them to indent the code. Is it something wrong? I've never noticed any problems related to this. Should I avoid using tabs?</description>
    <pubDate>Mon, 05 Sep 2022 14:55:32 GMT</pubDate>
    <dc:creator>chris2377</dc:creator>
    <dc:date>2022-09-05T14:55:32Z</dc:date>
    <item>
      <title>Intck + dates stored as macro variables = error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831550#M328621</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to calculate time interval between two days stroed as macro variables like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start_date = %sysfunc(mdy(12,31,2018));
%let end_date = %sysfunc(mdy(12,31,2019));
%let dif = %sysfunc(intck('qtr', &amp;amp;start_date, &amp;amp;end_date));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I get an error saying:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;WARNING: An argument to the function INTCK referenced by the %SYSFUNC or %QSYSFUNC macro&lt;BR /&gt;function is out of range.&lt;BR /&gt;NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The&lt;BR /&gt;result of the operations have been set to a missing value.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;IF I do it in a data step, it works, so I guess there is some issue with the macro variable assignment?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	input start_date :date. end_date :date.;
	datalines;
	"31dec2018"d "31dec2019"d
	;
run;
data test;
	set test;
	dif = intck('qtr', start_date, end_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 13:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831550#M328621</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2022-09-02T13:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Intck + dates stored as macro variables = error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831556#M328623</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24842"&gt;@chris2377&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the DATA step the single quotes around the first argument of the INTCK function indicate correctly that the three letters&amp;nbsp;&lt;FONT face="courier new,courier"&gt;qtr&lt;/FONT&gt;&amp;nbsp;are a character argument, i.e., text (and not a variable name).&amp;nbsp;For the macro processor, however, basically &lt;EM&gt;everything&lt;/EM&gt; is text -- including those single quotes, which are therefore misinterpreted as part of the INTCK function argument. Just remove the quotes:&lt;/P&gt;
&lt;PRE&gt;%let dif = %sysfunc(intck(qtr, &amp;amp;start_date, &amp;amp;end_date));&lt;/PRE&gt;
&lt;P&gt;(BTW, you don't need the quotes and the trailing "&lt;FONT face="courier new,courier"&gt;d&lt;/FONT&gt;" when reading date values with the DATE. informat. Also, there are leading tab characters in your DATA step code.)&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 14:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831556#M328623</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-09-02T14:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Intck + dates stored as macro variables = error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831817#M328766</link>
      <description>Many thanks @FreelanceReinhard&lt;BR /&gt;&lt;BR /&gt;As for the leading tab characters in the data step code - yes, they're there. I use them to indent the code. Is it something wrong? I've never noticed any problems related to this. Should I avoid using tabs?</description>
      <pubDate>Mon, 05 Sep 2022 14:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831817#M328766</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2022-09-05T14:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Intck + dates stored as macro variables = error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831818#M328767</link>
      <description>&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=SsoOG6ZeyUI" target="_self"&gt;TABS in code is a heated debate&lt;/A&gt;, but TABS in data is serious mistake.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do not indent the lines of data.&amp;nbsp; How will know where column 3 is?&lt;/P&gt;
&lt;P&gt;To make it easier to remember also do not indent the DATALINES (aka CARDS) statement.&amp;nbsp; Then it will be easier to remember not to indent the lines of data.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 15:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831818#M328767</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-05T15:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Intck + dates stored as macro variables = error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831835#M328777</link>
      <description>&lt;P&gt;You're welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on the user interface and its settings how tab characters in code or datalines are handled. So it can happen that code reading datalines including tabs works without problems with one user interface, but causes problems with a different&amp;nbsp;user interface. Last week this issue occurred in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Search-inquire-in-two-columns/m-p/831551/highlight/true#M328622" target="_blank" rel="noopener"&gt;another thread&lt;/A&gt;. Using spaces instead ensures that SAS code and datalines are handled consistently in SAS Studio, the traditional Display Manager interface, SAS Enterprise Guide or whatever interface people are using.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 16:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intck-dates-stored-as-macro-variables-error/m-p/831835#M328777</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-09-05T16:22:34Z</dc:date>
    </item>
  </channel>
</rss>

