<?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 calculate a time interval using macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243555#M45295</link>
    <description>&lt;PRE&gt;data WORK.Time    ;
      infile 'Data.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
          format StartTime datetime. ;
          format ClosingTime datetime. ;
      input
            ID $12.
            StartTime :YMDDTTM.
            ClosingTime :YMDDTTM.
            Fee 
            time=INTCK('minute',ClosingTime,StartTime);&lt;BR /&gt;     run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to use the above code to input two time variables and calculate the interval between them. The time format was like&amp;nbsp; &lt;/P&gt;
&lt;P&gt;2014-01-01 02:56:37 and after reading into SAS, it is like 01JAN14:02:56:37&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I use&lt;/P&gt;
&lt;PRE&gt;time=INTCK('minute',ClosingTime,StartTime);&lt;/PRE&gt;
&lt;P&gt;but the INTCK function gave error: &lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _CHAR_, _NUMERIC_.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I use &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   time = ClosingTime-StartTime;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;RROR: Missing numeric suffix on a numbered variable list (ClosingTime-StartTime). &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any hints?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jan 2016 19:03:14 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2016-01-14T19:03:14Z</dc:date>
    <item>
      <title>calculate a time interval using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243555#M45295</link>
      <description>&lt;PRE&gt;data WORK.Time    ;
      infile 'Data.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
          format StartTime datetime. ;
          format ClosingTime datetime. ;
      input
            ID $12.
            StartTime :YMDDTTM.
            ClosingTime :YMDDTTM.
            Fee 
            time=INTCK('minute',ClosingTime,StartTime);&lt;BR /&gt;     run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to use the above code to input two time variables and calculate the interval between them. The time format was like&amp;nbsp; &lt;/P&gt;
&lt;P&gt;2014-01-01 02:56:37 and after reading into SAS, it is like 01JAN14:02:56:37&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I use&lt;/P&gt;
&lt;PRE&gt;time=INTCK('minute',ClosingTime,StartTime);&lt;/PRE&gt;
&lt;P&gt;but the INTCK function gave error: &lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _CHAR_, _NUMERIC_.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I use &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   time = ClosingTime-StartTime;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;RROR: Missing numeric suffix on a numbered variable list (ClosingTime-StartTime). &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any hints?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 19:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243555#M45295</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-01-14T19:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: calculate a time interval using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243557#M45296</link>
      <description>&lt;P&gt;Are you missing the semicolon at the end of the INPUT statement?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 19:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243557#M45296</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-01-14T19:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: calculate a time interval using macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243559#M45298</link>
      <description>&lt;P&gt;yes. thanks.&lt;BR /&gt;this solved the problem. &lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 19:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-a-time-interval-using-macro-variables/m-p/243559#M45298</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-01-14T19:20:30Z</dc:date>
    </item>
  </channel>
</rss>

