<?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: Combine Date Time (both char variables) into one numeric DATETIME variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423998#M104340</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your input. Yes, I am using the exact code that I posted.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-I copied and pasted the code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date $ time $;
put time;/*display time in the log*/
datalines;
20171102 0024
20171212 1124
20170708 1020
20170808 0030
;
run;

data want;
  set have;
  sdate=input(date,yymmdd10.);
  stime=input(put(input(time,4.),z4.),hhmmss8.);
  datetime=put(dhms(sdate,0,0,stime),DATETIME.);
put stime;/*display stime in the log*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;-The log looks like this:&lt;/STRONG&gt;&lt;BR /&gt;3845&amp;nbsp; data have;&lt;BR /&gt;3846&amp;nbsp; input date $ time $;&lt;BR /&gt;3847&amp;nbsp; put time; /*display time in the log*/&lt;BR /&gt;3848&amp;nbsp; datalines;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;0024&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1124&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1020&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;0030&lt;/STRONG&gt;&lt;BR /&gt;NOTE: The data set WORK.HAVE has 4 observations and 2 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3853&amp;nbsp; ;&lt;BR /&gt;3854&lt;BR /&gt;3855&amp;nbsp; run;&lt;BR /&gt;3856&lt;BR /&gt;3857&lt;BR /&gt;3858&lt;BR /&gt;3859&amp;nbsp; data want;&lt;BR /&gt;3860&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;BR /&gt;3861&amp;nbsp;&amp;nbsp;&amp;nbsp; sdate=input(date,yymmdd10.);&lt;BR /&gt;3862&amp;nbsp;&amp;nbsp;&amp;nbsp; stime=input(put(input(time,4.),z4.),hhmmss8.);&lt;BR /&gt;3863&amp;nbsp;&amp;nbsp;&amp;nbsp; datetime=put(dhms(sdate,0,0,stime),DATETIME.);&lt;BR /&gt;3864&amp;nbsp; put stime; /*display stime in the log*/&lt;BR /&gt;3865&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;86400&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;41040&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;37200&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;108000&lt;/STRONG&gt;&lt;BR /&gt;NOTE: There were 4 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.WANT has 4 observations and 5 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I do find that when I view "Have" in the excel file, it appears like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171102&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171212&lt;/TD&gt;&lt;TD&gt;1124&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170708&lt;/TD&gt;&lt;TD&gt;1020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170808&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The leading zero disappears and I think this is why the resulting stime is 86400 (from reading time as 24:00) for the first row.&lt;/P&gt;&lt;P&gt;Do you know what might have gone wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Dec 2017 05:42:26 GMT</pubDate>
    <dc:creator>ppchennn</dc:creator>
    <dc:date>2017-12-29T05:42:26Z</dc:date>
    <item>
      <title>Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423854#M104272</link>
      <description>&lt;P&gt;I have a raw dataset which have a character DATE variable and a character TIME variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried to combine them into one Numeric DATETIME variable, I found that whenever the TIME is 00:xx(hh:mm), the combined DATETIME variable will be shifted by one day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code:&lt;/P&gt;&lt;P&gt;(note that I did not define DATE/TIME into Numeric Format in the first DATA STEP because my raw dataset is like this.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA have;
input DATE $ TIME $;
datalines;
20171102 0024
20171212 1124
20170708 1020
20170808 0030
;
run;

data want; set have;
sdate=input(date,yymmdd10.);
stime=input(time,hhmmss8.);
datetime=put(dhms(sdate,0,0,stime),DATETIME.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am thinking maybe the format for sdate and stime is inappropriate?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 06:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423854#M104272</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2017-12-28T06:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423862#M104275</link>
      <description>&lt;P&gt;Can't replicate your problem:&lt;/P&gt;
&lt;P&gt;20171102&amp;nbsp;&amp;nbsp; &amp;nbsp;0024&amp;nbsp;&amp;nbsp; &amp;nbsp;21125&amp;nbsp;&amp;nbsp; &amp;nbsp;1440&amp;nbsp;&amp;nbsp; &amp;nbsp;02NOV17:00:24:00&lt;BR /&gt;20171212&amp;nbsp;&amp;nbsp; &amp;nbsp;1124&amp;nbsp;&amp;nbsp; &amp;nbsp;21165&amp;nbsp;&amp;nbsp; &amp;nbsp;41040&amp;nbsp;&amp;nbsp; &amp;nbsp;12DEC17:11:24:00&lt;BR /&gt;20170708&amp;nbsp;&amp;nbsp; &amp;nbsp;1020&amp;nbsp;&amp;nbsp; &amp;nbsp;21008&amp;nbsp;&amp;nbsp; &amp;nbsp;37200&amp;nbsp;&amp;nbsp; &amp;nbsp;08JUL17:10:20:00&lt;BR /&gt;20170808&amp;nbsp;&amp;nbsp; &amp;nbsp;0030&amp;nbsp;&amp;nbsp; &amp;nbsp;21039&amp;nbsp;&amp;nbsp; &amp;nbsp;1800&amp;nbsp;&amp;nbsp; &amp;nbsp;08AUG17:00:30:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 07:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423862#M104275</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-12-28T07:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423863#M104276</link>
      <description>&lt;P&gt;my output looks like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DATE&lt;/TD&gt;&lt;TD&gt;TIME&lt;/TD&gt;&lt;TD&gt;sdate&lt;/TD&gt;&lt;TD&gt;stime&lt;/TD&gt;&lt;TD&gt;datetime&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171102&lt;/TD&gt;&lt;TD&gt;0024&lt;/TD&gt;&lt;TD&gt;21125&lt;/TD&gt;&lt;TD&gt;86400&lt;/TD&gt;&lt;TD&gt;03NOV17:00:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171212&lt;/TD&gt;&lt;TD&gt;1124&lt;/TD&gt;&lt;TD&gt;21165&lt;/TD&gt;&lt;TD&gt;41040&lt;/TD&gt;&lt;TD&gt;12DEC17:11:24:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170708&lt;/TD&gt;&lt;TD&gt;1020&lt;/TD&gt;&lt;TD&gt;21008&lt;/TD&gt;&lt;TD&gt;37200&lt;/TD&gt;&lt;TD&gt;08JUL17:10:20:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170808&lt;/TD&gt;&lt;TD&gt;0030&lt;/TD&gt;&lt;TD&gt;21039&lt;/TD&gt;&lt;TD&gt;108000&lt;/TD&gt;&lt;TD&gt;09AUG17:06:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;seems like something is not right with my stime.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 08:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423863#M104276</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2017-12-28T08:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423890#M104290</link>
      <description>&lt;P&gt;&lt;FONT face="georgia,palatino"&gt;Hi, have you already figured out?&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date $ time $;
datalines;
20171102 0024
20171212 1124
20170708 1020
20170808 0030
;
run;

data want; 
	set have;
	sdate=input(date,anydtdte12.);
	stime=input(substr(time,1,2)||':'||substr(time,3,2),time6.);
	stime_wrong=input(time,hhmmss6.);
	dtime=dhms(sdate,0,0,stime);
	format sdate date11. stime time6. stime_wrong time6. dtime datetime15. ;
run;

proc print noobs data=want; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Dec 2017 13:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423890#M104290</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2017-12-28T13:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423901#M104291</link>
      <description>&lt;P&gt;I was only able to replicate your problem if the time variable didn't actually have the leading zeros as shown in your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is indeed the case, and is only showing them because you're using a z4. format in printing them, then code like the following might solve your problem:&lt;/P&gt;
&lt;PRE&gt;data have;
  input DATE $ TIME $;
  datalines;
20171102 24
20171212 1124
20170708 1020
20170808 30
;
run;

data want;
  set have;
  sdate=input(date,yymmdd10.);
  stime=input(put(input(time,4.),z4.),hhmmss8.);
  datetime=put(dhms(sdate,0,0,stime),DATETIME.);
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 14:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423901#M104291</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-12-28T14:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423989#M104336</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Thank you for your input! My data does have the 0 as in the first data step.&lt;/P&gt;&lt;P&gt;Your code does not work for me as well, I'm guessing it might be that my SAS is an older 9.3 version.&lt;/P&gt;&lt;P&gt;But you minded me to be careful with the formats, thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 01:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423989#M104336</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2017-12-29T01:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423990#M104337</link>
      <description>Hi, Thank you for the input! I am using the same method by adding a ":" to stime as a workaround. Just wondering, are you also using SAS 9.3?</description>
      <pubDate>Fri, 29 Dec 2017 01:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423990#M104337</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2017-12-29T01:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423991#M104338</link>
      <description>Mine is 9.4.</description>
      <pubDate>Fri, 29 Dec 2017 01:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423991#M104338</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2017-12-29T01:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423993#M104339</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134173"&gt;@ppchennn&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;For the code you've posted SAS should return the correct result since quite a few versions so being on SAS 9.3 is highly likely not the explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you really telling us that if you execute the exact code as you've posted, the time in the first row gets translated into 86400 (=number seconds of 1 day)? That would be very mysterious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm assuming that there must be something going on with your raw data.&lt;/P&gt;
&lt;P&gt;To check if this is data related or something else&amp;nbsp;can I please ask you to do exactly the same than what we're doing: Copy/paste the code and data you've posted from here into a new SAS code window in your environment, execute the code and tell us if you still get the wrong result (I'd be very surprised if you do).&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 02:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423993#M104339</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-12-29T02:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423998#M104340</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your input. Yes, I am using the exact code that I posted.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-I copied and pasted the code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date $ time $;
put time;/*display time in the log*/
datalines;
20171102 0024
20171212 1124
20170708 1020
20170808 0030
;
run;

data want;
  set have;
  sdate=input(date,yymmdd10.);
  stime=input(put(input(time,4.),z4.),hhmmss8.);
  datetime=put(dhms(sdate,0,0,stime),DATETIME.);
put stime;/*display stime in the log*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;-The log looks like this:&lt;/STRONG&gt;&lt;BR /&gt;3845&amp;nbsp; data have;&lt;BR /&gt;3846&amp;nbsp; input date $ time $;&lt;BR /&gt;3847&amp;nbsp; put time; /*display time in the log*/&lt;BR /&gt;3848&amp;nbsp; datalines;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;0024&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1124&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1020&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;0030&lt;/STRONG&gt;&lt;BR /&gt;NOTE: The data set WORK.HAVE has 4 observations and 2 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3853&amp;nbsp; ;&lt;BR /&gt;3854&lt;BR /&gt;3855&amp;nbsp; run;&lt;BR /&gt;3856&lt;BR /&gt;3857&lt;BR /&gt;3858&lt;BR /&gt;3859&amp;nbsp; data want;&lt;BR /&gt;3860&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;BR /&gt;3861&amp;nbsp;&amp;nbsp;&amp;nbsp; sdate=input(date,yymmdd10.);&lt;BR /&gt;3862&amp;nbsp;&amp;nbsp;&amp;nbsp; stime=input(put(input(time,4.),z4.),hhmmss8.);&lt;BR /&gt;3863&amp;nbsp;&amp;nbsp;&amp;nbsp; datetime=put(dhms(sdate,0,0,stime),DATETIME.);&lt;BR /&gt;3864&amp;nbsp; put stime; /*display stime in the log*/&lt;BR /&gt;3865&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;86400&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;41040&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;37200&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;108000&lt;/STRONG&gt;&lt;BR /&gt;NOTE: There were 4 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.WANT has 4 observations and 5 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I do find that when I view "Have" in the excel file, it appears like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171102&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20171212&lt;/TD&gt;&lt;TD&gt;1124&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170708&lt;/TD&gt;&lt;TD&gt;1020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20170808&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The leading zero disappears and I think this is why the resulting stime is 86400 (from reading time as 24:00) for the first row.&lt;/P&gt;&lt;P&gt;Do you know what might have gone wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 05:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423998#M104340</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2017-12-29T05:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423999#M104341</link>
      <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider this example program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ;
  input @1 str $ @1 timeraw hhmmss8. ;
  time = timeraw ;
  format time time8.;
cards;
1122
0024
0011
002400
112233
001122
000011
00112233
11223344
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS version 9.4M2 on Windows the HHMMSS. informat will treat '0024' as representing '24:00't.&lt;/P&gt;
&lt;PRE&gt;SAS 9.4 on WINDOWS

Obs    str         timeraw        time

 1     1122          40920    11:22:00
 2     0024          86400    24:00:00
 3     0011          39600    11:00:00
 4     002400         1440     0:24:00
 5     112233        40953    11:22:33
 6     001122          682     0:11:22
 7     000011           11     0:00:11
 8     00112233      40953    11:22:33
 9     11223344    4041224     1122:33
&lt;/PRE&gt;
&lt;P&gt;But on SAS 9.2 on Linux it reads is as 24 seconds.&lt;/P&gt;
&lt;PRE&gt;Obs    str         timeraw        time

 1     1122            682     0:11:22
 2     0024             24     0:00:24
 3     0011             11     0:00:11
 4     002400         1440     0:24:00
 5     112233        40953    11:22:33
 6     001122          682     0:11:22
 7     000011           11     0:00:11
 8     00112233      40953    11:22:33
 9     11223344    4041224     1122:33
&lt;/PRE&gt;
&lt;P&gt;With SAS 9.4 M5 on Linux it reads it as 24 minutes.&lt;/P&gt;
&lt;PRE&gt;Obs    str         timeraw        time

 1     1122          40920    11:22:00
 2     0024           1440     0:24:00
 3     0011            660     0:11:00
 4     002400         1440     0:24:00
 5     112233        40953    11:22:33
 6     001122          682     0:11:22
 7     000011           11     0:00:11
 8     00112233      40953    11:22:33
 9     11223344    4041224     1122:33&lt;/PRE&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 05:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/423999#M104341</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-12-29T05:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/424082#M104371</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134173"&gt;@ppchennn&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;It appears that the behavior of the HHMMSS. informat differs between versions as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;illustrates. That's&amp;nbsp;something very unusual for SAS software.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a SAS Note which somehow addresses this - but I find this Note rather confusing and&amp;nbsp;your case is also not specifically covered.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/39/035.html&amp;nbsp;" target="_blank"&gt;http://support.sas.com/kb/39/035.html&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May be try informat&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;B8601TM&lt;/STRONG&gt;. instead of HHMMSS. as mentioned in above note. It works in my SAS9.4 M3 Windows environment.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date $ time $;
  put time;/*display time in the log*/
  datalines;
20171102 0024
20171212 1124
20170708 1020
20170808 0030
;
run;

data want;
  set have;
  sdate=input(date,yymmdd10.);
  stime=input(time,b8601tm.);
  datetime=put(dhms(sdate,0,0,stime),DATETIME.);
  put stime;/*display stime in the log*/
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 22:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/424082#M104371</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-12-29T22:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Date Time (both char variables) into one numeric DATETIME variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/424313#M104481</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;Thank you for the input!&lt;BR /&gt;The informat&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;B8601TM&lt;/STRONG&gt;. works for my SAS 9.3 Windows environment as well.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 13:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Date-Time-both-char-variables-into-one-numeric-DATETIME/m-p/424313#M104481</guid>
      <dc:creator>ppchennn</dc:creator>
      <dc:date>2018-01-02T13:16:45Z</dc:date>
    </item>
  </channel>
</rss>

