<?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 Date variable change from character to date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743767#M38872</link>
    <description>&lt;P&gt;I have a data set "hvid11", imported from a RedCap database as excel originately.&lt;/P&gt;&lt;P&gt;I imported it and now one of my&amp;nbsp;date variables (debutskopi_date) is defined as a character with values around 41000 in stead of a date.&lt;/P&gt;&lt;P&gt;My goal was to change is so the dates have the format "MM/DD/YYYY"&lt;/P&gt;&lt;P&gt;I tried to change it to a date variable using this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; hvid11; &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; hvid11;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;debutskopi_date2= input(debutskopi_date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;anydtdte32.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;Format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; debutskopi_date2 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;But the output variabel&amp;nbsp;debutskopi_date2 has wrong dates.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The years in the dates&amp;nbsp;should be between 2013 and 2020, but is in stead&amp;nbsp;between 1940 and 1944&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Any suggestions will be greatly approciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Best regards Anne&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 07:08:51 GMT</pubDate>
    <dc:creator>AnneLK</dc:creator>
    <dc:date>2021-05-26T07:08:51Z</dc:date>
    <item>
      <title>Date variable change from character to date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743767#M38872</link>
      <description>&lt;P&gt;I have a data set "hvid11", imported from a RedCap database as excel originately.&lt;/P&gt;&lt;P&gt;I imported it and now one of my&amp;nbsp;date variables (debutskopi_date) is defined as a character with values around 41000 in stead of a date.&lt;/P&gt;&lt;P&gt;My goal was to change is so the dates have the format "MM/DD/YYYY"&lt;/P&gt;&lt;P&gt;I tried to change it to a date variable using this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; hvid11; &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; hvid11;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;debutskopi_date2= input(debutskopi_date,&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;anydtdte32.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;Format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; debutskopi_date2 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#08726d"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;But the output variabel&amp;nbsp;debutskopi_date2 has wrong dates.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;The years in the dates&amp;nbsp;should be between 2013 and 2020, but is in stead&amp;nbsp;between 1940 and 1944&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Any suggestions will be greatly approciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Best regards Anne&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 07:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743767#M38872</guid>
      <dc:creator>AnneLK</dc:creator>
      <dc:date>2021-05-26T07:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable change from character to date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743780#M38873</link>
      <description>&lt;P&gt;You imported this from Excel, and because of some funny values in the column you got the raw Excel values as character. Do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;debutskopi_date2= input(debutskopi_date,32.) + '30dec1899'd;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to correct for the different offset in SAS vs. Excel.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 08:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743780#M38873</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-26T08:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable change from character to date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743785#M38874</link>
      <description>Brilliant!&lt;BR /&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Best regards Anne</description>
      <pubDate>Wed, 26 May 2021 09:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-variable-change-from-character-to-date/m-p/743785#M38874</guid>
      <dc:creator>AnneLK</dc:creator>
      <dc:date>2021-05-26T09:14:00Z</dc:date>
    </item>
  </channel>
</rss>

