<?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: Arrival and Departure Delay in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432092#M106953</link>
    <description>&lt;P&gt;If you have a date and a time for both the acheduled and the actual departure time, then convert to datetime values and use the INTCK function on those&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Schedule_dep_date:date9. Schedule_dep_time:time. Actual_dep_date:date9. Actual_dep_time:time.;
format Schedule_dep_date Actual_dep_date date9. Schedule_dep_time Actual_dep_time time.;
datalines;
30jan2018 11:45PM 31jan2018 01:00AM
;

data want;
&amp;nbsp;&amp;nbsp; set have;
&amp;nbsp;&amp;nbsp; Schedule_dep_dt=dhms(Schedule_dep_date,0,0,Schedule_dep_time);
&amp;nbsp;&amp;nbsp; Actual_dep_dt=dhms(Actual_dep_date,0,0,Actual_dep_time);
&amp;nbsp;&amp;nbsp; dep_delay=intck('minute',Schedule_dep_dt, Actual_dep_dt);
&amp;nbsp;&amp;nbsp; format dt datetime.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 30 Jan 2018 08:15:40 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-01-30T08:15:40Z</dc:date>
    <item>
      <title>Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432070#M106939</link>
      <description>&lt;P&gt;Hi, So I have a dataset of Flights. In that i have Variables like &lt;STRONG&gt;Schedule_dep,&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;Schedule_arr, actual_dep, actual_arr &lt;/STRONG&gt;and I have to calculate delay from these variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The problem here is whenever the date changes for eg:-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Schedule_dep:- 11:45 Pm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Actual_dep:- 01:00 Am&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;The result that I'm getting is something -2315 instead of 75 minutes.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;How to resolve this Plz help.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 06:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432070#M106939</guid>
      <dc:creator>abhi18</dc:creator>
      <dc:date>2018-01-30T06:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432076#M106943</link>
      <description>Please post example data. It is not clear of what type the variables are. How do you calculate the difference? Have you tried the appropriate function?</description>
      <pubDate>Tue, 30 Jan 2018 07:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432076#M106943</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2018-01-30T07:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432079#M106945</link>
      <description>&lt;P&gt;What does your code look like now?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432079#M106945</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-30T07:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432080#M106946</link>
      <description>&lt;P&gt;Data types are:-&lt;/P&gt;&lt;P&gt;Schedule and Actual arrival :- Numeric&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function that I'm using is &lt;STRONG&gt;Intck()&lt;/STRONG&gt;, So I'm getting the desired output for rest of the observations only those are creating a problem in which the date for &lt;STRONG&gt;actual_dep&lt;/STRONG&gt; changes after 00:00 HRS&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432080#M106946</guid>
      <dc:creator>abhi18</dc:creator>
      <dc:date>2018-01-30T07:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432083#M106948</link>
      <description>&lt;P&gt;Using this code to get the delay:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dep_delay = intck('minute',scd_dep_time,dept_time);&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432083#M106948</guid>
      <dc:creator>abhi18</dc:creator>
      <dc:date>2018-01-30T07:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432085#M106949</link>
      <description>&lt;P&gt;If you do not bring the dates into the calculations, you will not be able to get the desired result. What does your data look like? Do you have a date variable as well?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432085#M106949</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-30T07:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432087#M106950</link>
      <description>&lt;P&gt;Your problem comes from the fact that you are working with time values, while you should be working with datetime values.&lt;/P&gt;
&lt;P&gt;I take it that your dataset also contains dates; you can easily create datetimes fro the date and time values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show the code you are using now, and a quick overview of the variables in your dataset, with type and formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432087#M106950</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-30T07:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432088#M106951</link>
      <description>&lt;P&gt;You need to have date with time, to get the exact result.&lt;/P&gt;&lt;P&gt;If you have the date of departure with you, then multiply it by 3600 and then add it to time of departure. Same with arrival.&lt;/P&gt;&lt;P&gt;Then you do not need to use any function just subtraction will give you the difference of time in seconds.&lt;BR /&gt;Afterwards you can use formats to display them as you want.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432088#M106951</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-01-30T07:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432091#M106952</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138619"&gt;@Satish_Parida&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;You need to have date with time, to get the exact result.&lt;/P&gt;
&lt;P&gt;If you have the date of departure with you, then multiply it by 3600 and then add it to time of departure. Same with arrival.&lt;/P&gt;
&lt;P&gt;Then you do not need to use any function just subtraction will give you the difference of time in seconds.&lt;BR /&gt;Afterwards you can use formats to display them as you want.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Correction: a day has 86400 seconds, so the date needs to be multiplied by that.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 07:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432091#M106952</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-30T07:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432092#M106953</link>
      <description>&lt;P&gt;If you have a date and a time for both the acheduled and the actual departure time, then convert to datetime values and use the INTCK function on those&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Schedule_dep_date:date9. Schedule_dep_time:time. Actual_dep_date:date9. Actual_dep_time:time.;
format Schedule_dep_date Actual_dep_date date9. Schedule_dep_time Actual_dep_time time.;
datalines;
30jan2018 11:45PM 31jan2018 01:00AM
;

data want;
&amp;nbsp;&amp;nbsp; set have;
&amp;nbsp;&amp;nbsp; Schedule_dep_dt=dhms(Schedule_dep_date,0,0,Schedule_dep_time);
&amp;nbsp;&amp;nbsp; Actual_dep_dt=dhms(Actual_dep_date,0,0,Actual_dep_time);
&amp;nbsp;&amp;nbsp; dep_delay=intck('minute',Schedule_dep_dt, Actual_dep_dt);
&amp;nbsp;&amp;nbsp; format dt datetime.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 08:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432092#M106953</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-30T08:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432093#M106954</link>
      <description>&lt;DIV class="dgrid-header dgrid-header-row ui-widget-header"&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;P&gt;&lt;STRONG&gt;I do have the date variable...Data shared below:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Obs&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Scd_dep&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arr_time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delay&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6210&lt;/TD&gt;&lt;TD&gt;12/03/2013&lt;/TD&gt;&lt;TD&gt;8:35:00 PM&lt;/TD&gt;&lt;TD&gt;8:53:00 PM&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6211&lt;/TD&gt;&lt;TD&gt;11/11/2013&lt;/TD&gt;&lt;TD&gt;2:59:00 PM&lt;/TD&gt;&lt;TD&gt;2:56:00 PM&lt;/TD&gt;&lt;TD&gt;-3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6212&lt;/TD&gt;&lt;TD&gt;12/19/2013&lt;/TD&gt;&lt;TD&gt;8:27:00 PM&lt;/TD&gt;&lt;TD&gt;8:22:00 PM&lt;/TD&gt;&lt;TD&gt;-5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6213&lt;/TD&gt;&lt;TD&gt;11/12/2013&lt;/TD&gt;&lt;TD&gt;8:30:00 AM&lt;/TD&gt;&lt;TD&gt;10:06:00 AM&lt;/TD&gt;&lt;TD&gt;96&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6214&lt;/TD&gt;&lt;TD&gt;12/21/2013&lt;/TD&gt;&lt;TD&gt;2:59:00 PM&lt;/TD&gt;&lt;TD&gt;3:27:00 PM&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6215&lt;/TD&gt;&lt;TD&gt;12/10/2013&lt;/TD&gt;&lt;TD&gt;8:35:00 PM&lt;/TD&gt;&lt;TD&gt;8:31:00 PM&lt;/TD&gt;&lt;TD&gt;-4&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;6216&lt;/TD&gt;&lt;TD&gt;02/15/2013&lt;/TD&gt;&lt;TD&gt;3:05:00 PM&lt;/TD&gt;&lt;TD&gt;3:03:00 PM&lt;/TD&gt;&lt;TD&gt;-2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default dgrid-selected ui-state-active"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;6217&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12/05/2013&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;8:35:00 PM&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12:27:00 AM&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;-1208&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="dgrid-scroller"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Jan 2018 08:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432093#M106954</guid>
      <dc:creator>abhi18</dc:creator>
      <dc:date>2018-01-30T08:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432094#M106955</link>
      <description>Understood...Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 30 Jan 2018 08:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432094#M106955</guid>
      <dc:creator>abhi18</dc:creator>
      <dc:date>2018-01-30T08:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arrival and Departure Delay</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432096#M106957</link>
      <description>&lt;P&gt;To get precise results, you need to have dates for scheduled &lt;EM&gt;and&lt;/EM&gt; actual time. Otherwise, you'll have to make guesses (if the number is far enough in the negative range, add 1440 (number of minutes for a day)). But that will obviously fail when the delay exceeds one day.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 08:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrival-and-Departure-Delay/m-p/432096#M106957</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-30T08:12:15Z</dc:date>
    </item>
  </channel>
</rss>

