<?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 Character Date Conversion to Proper Date Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825377#M326022</link>
    <description>&lt;P&gt;various date and date-time fields imported as character ($18.)&lt;/P&gt;&lt;P&gt;date 1&lt;/P&gt;&lt;P&gt;44474.44181712963&lt;/P&gt;&lt;P&gt;44474.49334490741&lt;/P&gt;&lt;P&gt;44474.52622685185&lt;/P&gt;&lt;P&gt;44475.32769675926&lt;/P&gt;&lt;P&gt;44476.46425925926&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wrote this code to convert to the character string to a date format, however they all come back as missing (.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Enrollment1_R2_&amp;amp;V; set Enrollment1_R_&amp;amp;V;&lt;BR /&gt;SurveyDT=input(strip(qdate), mmddyy10.);&lt;BR /&gt;ConsentDT=input(strip(consent_date), mmddyy10.);&lt;BR /&gt;EnrollmentDT=input(strip(Enrollment_date), mmddyy10.);&lt;BR /&gt;DOBDT=input(strip(dob), mmddyy10.);&lt;BR /&gt;format surveydt consentdt enrollmentdt dobdt mmddyy10.;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2022 01:11:54 GMT</pubDate>
    <dc:creator>lberghammer</dc:creator>
    <dc:date>2022-07-26T01:11:54Z</dc:date>
    <item>
      <title>Character Date Conversion to Proper Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825377#M326022</link>
      <description>&lt;P&gt;various date and date-time fields imported as character ($18.)&lt;/P&gt;&lt;P&gt;date 1&lt;/P&gt;&lt;P&gt;44474.44181712963&lt;/P&gt;&lt;P&gt;44474.49334490741&lt;/P&gt;&lt;P&gt;44474.52622685185&lt;/P&gt;&lt;P&gt;44475.32769675926&lt;/P&gt;&lt;P&gt;44476.46425925926&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wrote this code to convert to the character string to a date format, however they all come back as missing (.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Enrollment1_R2_&amp;amp;V; set Enrollment1_R_&amp;amp;V;&lt;BR /&gt;SurveyDT=input(strip(qdate), mmddyy10.);&lt;BR /&gt;ConsentDT=input(strip(consent_date), mmddyy10.);&lt;BR /&gt;EnrollmentDT=input(strip(Enrollment_date), mmddyy10.);&lt;BR /&gt;DOBDT=input(strip(dob), mmddyy10.);&lt;BR /&gt;format surveydt consentdt enrollmentdt dobdt mmddyy10.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 01:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825377#M326022</guid>
      <dc:creator>lberghammer</dc:creator>
      <dc:date>2022-07-26T01:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion to Proper Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825382#M326026</link>
      <description>&lt;P&gt;Most computer software I'm familiar with does not store dates or date-times as decimals, including SAS. I'd be prepared to place a bet that this was imported from Excel. Internally Excel stores dates as the number of days since 1 Jan 1900, so 44474 could be represented as 7 Oct 2021. What the rest of the decimal represents is anyone's guess. If this is coming in from a spreadsheet then save it as a CSV and try importing again. At least as a CSV you have control over how the columns formats are handled.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 03:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825382#M326026</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-26T03:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion to Proper Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825396#M326033</link>
      <description>&lt;P&gt;These are most probably Exdel datetimes; they count the number of days from (nominally*) 1900-01-01 as day 1, and have the time as a fraction of the day.&lt;/P&gt;
&lt;P&gt;Do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dt_num = (input(dt_char,32.) + "30dec1899") * 86400;
format dt_num e8601dt19.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see if you get values identical to what you see in Excel..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* "nominally" because Excel has a bug which considers 1900 a leap year. 30dec1899 to also compensate for the fact that Excel starts with day 1, and SAS with day 0 for 1960-01-01.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 06:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion-to-Proper-Date-Format/m-p/825396#M326033</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-26T06:14:25Z</dc:date>
    </item>
  </channel>
</rss>

