<?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: How to import date and time that reads in as character? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-import-date-and-time-that-reads-in-as-character/m-p/568107#M27965</link>
    <description>&lt;P&gt;Did you try formatting the date as date?&lt;/P&gt;&lt;P&gt;Add a statement like:&lt;/P&gt;&lt;P&gt;FORMAT startdate date10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;DATA Work.dataset;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; infile datalines;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; input startdate anydtdte16.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; if startdate ~=.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; numericdate = startdate;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; format startdate date10.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; datalines;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; StartDate (variable name)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; Start Date&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; {"ImportId":"startDate","timeZone":"America/Denver"}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; 5/12/2019 16:16&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RUN;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jun 2019 05:25:12 GMT</pubDate>
    <dc:creator>arthurcavila</dc:creator>
    <dc:date>2019-06-22T05:25:12Z</dc:date>
    <item>
      <title>How to import date and time that reads in as character?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-import-date-and-time-that-reads-in-as-character/m-p/566976#M27933</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to import Qualtrics excel document and the raw data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;StartDate (variable name)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;{"ImportId":"startDate","timeZone":"America/Denver"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/12/2019 16:16&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I deleted the observations that weren't relevant (rows 2 and 3) but the problem I'm running in to is that when I imported the excel sheet using the code below, I get output that looks like this "&lt;SPAN&gt;43597.6781712963" for&lt;/SPAN&gt; a date and time value of "5/12/2019 16:16," for example.&lt;/P&gt;&lt;PRE&gt;DATA Work.dataset;&lt;BR /&gt;	SET work.data;&lt;BR /&gt;	IF Startdate = '{"ImportId":"startDate","timeZone":"America/Denver"}' &lt;BR /&gt;		OR StartDate = 'Start Date' then DELETE; &lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I go to the OUTPUT DATA tab it shows that the StartDate variable is a character length of 52. Is there a way to change this so it reads it as a date and time like in the raw data file? Will deleting the 2nd and 3rd rows in the raw excel sheet solve my problem?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. I'm on SAS Studio v9.4, the free version for students.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 17:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-import-date-and-time-that-reads-in-as-character/m-p/566976#M27933</guid>
      <dc:creator>m_sd</dc:creator>
      <dc:date>2019-06-18T17:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to import date and time that reads in as character?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-import-date-and-time-that-reads-in-as-character/m-p/568107#M27965</link>
      <description>&lt;P&gt;Did you try formatting the date as date?&lt;/P&gt;&lt;P&gt;Add a statement like:&lt;/P&gt;&lt;P&gt;FORMAT startdate date10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;DATA Work.dataset;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; infile datalines;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; input startdate anydtdte16.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; if startdate ~=.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; numericdate = startdate;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; format startdate date10.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; datalines;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; StartDate (variable name)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; Start Date&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; {"ImportId":"startDate","timeZone":"America/Denver"}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; 5/12/2019 16:16&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RUN;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jun 2019 05:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-import-date-and-time-that-reads-in-as-character/m-p/568107#M27965</guid>
      <dc:creator>arthurcavila</dc:creator>
      <dc:date>2019-06-22T05:25:12Z</dc:date>
    </item>
  </channel>
</rss>

