<?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: SAS Changing Dates After Conversion from Character Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781777#M249165</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help. I had some trouble implementing this solution, and I found it easier just to delete the "N/As" indicating missing values from the Excel file before importing it to SAS, but your solution might help someone with a similar issue.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Nov 2021 20:33:43 GMT</pubDate>
    <dc:creator>leackell13</dc:creator>
    <dc:date>2021-11-22T20:33:43Z</dc:date>
    <item>
      <title>SAS Changing Dates After Conversion from Character Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781147#M248960</link>
      <description>&lt;P&gt;I imported an Excel file into SAS Studio. It read the date variables as character variables with a length of 5. For example, the first 3 data points of variable DOB are:&amp;nbsp;8/3/1957, 2/28/1971, and 10/18/1950. When I imported the file, they read as 21035, 25992, and 18554, respectively. So I changed the variable length and type:&lt;/P&gt;&lt;PRE&gt;DATA SubQ.dataclean2;&lt;BR /&gt;	&lt;BR /&gt;	LENGTH DOB $10.;&lt;BR /&gt;	&lt;BR /&gt;	SET SubQ.confounding;&lt;/PRE&gt;&lt;PRE&gt;format date_var mmddyy10.; /* Change dates from character to date values */&lt;BR /&gt;	date_var = input(DOB,mmddyy10.);&lt;BR /&gt;	DROP DOB;&lt;BR /&gt;	RENAME date_var=DOB;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;This successfully changed the variable length and type, but those 3 same points are shown as 02/10/1935, ., and ., respectively. Why? Does it have to do with how the dates are written in the Excel file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 21:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781147#M248960</guid>
      <dc:creator>leackell13</dc:creator>
      <dc:date>2021-11-18T21:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781155#M248963</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;they read as 21035, 25992, and 18554&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the conversion from Excel requires this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Conversion-from-Excel-Date-to-SAS-Date/td-p/475824" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Conversion-from-Excel-Date-to-SAS-Date/td-p/475824&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you do that conversion, and then format the result as DATE9. (or whatever format you would like to use) you will get the correct date.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 22:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781155#M248963</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-18T22:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781168#M248970</link>
      <description>&lt;P&gt;Looks like SAS is not recognised DOB as a date to begin with. Try changing the column type in Excel to date and import it again.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 01:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781168#M248970</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-11-19T01:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781279#M249009</link>
      <description>Thanks for the suggestion, but I had tried this earlier, and it didn't work.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Nov 2021 15:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781279#M249009</guid>
      <dc:creator>leackell13</dc:creator>
      <dc:date>2021-11-19T15:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Changing Dates After Conversion from Character Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781777#M249165</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help. I had some trouble implementing this solution, and I found it easier just to delete the "N/As" indicating missing values from the Excel file before importing it to SAS, but your solution might help someone with a similar issue.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 20:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Changing-Dates-After-Conversion-from-Character-Variable/m-p/781777#M249165</guid>
      <dc:creator>leackell13</dc:creator>
      <dc:date>2021-11-22T20:33:43Z</dc:date>
    </item>
  </channel>
</rss>

