<?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: base sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444351#M111237</link>
    <description>&lt;P&gt;One way to go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dlm=' ' truncover;
  input vsdat $10. vstim $5.;
  datalines;
2018/01/19 
2017/12/22 10:53
;
run;

data want;
   set have;
   format dttm B8601DT.;
   dttm=input(catx(' ',vsdat,vstim),anydtdtm.);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 10 Mar 2018 05:34:26 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-03-10T05:34:26Z</dc:date>
    <item>
      <title>Create datetime from date and time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444347#M111235</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I have a dataset where there are date and time variables. Date is in yyyy-mm-dd format and time is time5. format. Both are text varaibles.&lt;/P&gt;
&lt;P&gt;I need to create a date time variable with iso8601 format. Some of the time values are missing.&lt;/P&gt;
&lt;P&gt;I need a result with this condition:&lt;/P&gt;
&lt;P&gt;if time is missing, then datetime variable should have only date part.&lt;/P&gt;
&lt;P&gt;later I need to convert this datetime variable into&amp;nbsp;Numeric value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;vsdat&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vstim&lt;/P&gt;
&lt;P&gt;2018/01/19&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;&lt;/P&gt;
&lt;P&gt;2017/12/22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10:53&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where vstim is blank.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 13:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444347#M111235</guid>
      <dc:creator>rashmirao99</dc:creator>
      <dc:date>2018-03-10T13:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444349#M111236</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/175984"&gt;@rashmirao99&lt;/a&gt;&amp;nbsp; If your vsdat variable and time vstim are&amp;nbsp; numeric, I'd suggest to keep the new variable as a datetime variable substituting 0 in place of missing and combine the two variables using dhms function. This will help in maintaining consistency in my opinion.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 05:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444349#M111236</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-10T05:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444351#M111237</link>
      <description>&lt;P&gt;One way to go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dlm=' ' truncover;
  input vsdat $10. vstim $5.;
  datalines;
2018/01/19 
2017/12/22 10:53
;
run;

data want;
   set have;
   format dttm B8601DT.;
   dttm=input(catx(' ',vsdat,vstim),anydtdtm.);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 05:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444351#M111237</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-10T05:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create datetime from date and time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444382#M111248</link>
      <description>You can't fulfil the requirement, at least not in SAS.&lt;BR /&gt;A numeric variable cannot contain mixed datetime and date values, this since formats can work only with either type. This is again feels like that someone who doesn't understand the implications for a requirement is set to specify one. And you with a quite distance from the end user just have to comply, no questions asked.&lt;BR /&gt;As suggested by others, set a valid time value when it's missing. Check with your stakeholders for guidance.&lt;BR /&gt;Or store the concatenated value in a string.</description>
      <pubDate>Sat, 10 Mar 2018 13:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-datetime-from-date-and-time/m-p/444382#M111248</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-10T13:42:57Z</dc:date>
    </item>
  </channel>
</rss>

