<?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: Importing xlsx data into SAS changed date variable format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-xlsx-data-into-SAS-changed-date-variable-format/m-p/898545#M355150</link>
    <description>&lt;P&gt;Since you didn't show any of the code that you used to "convert" the values there isn't much to address on that part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How sure are you of this description: mm/dd/yyyy hh:ss ? I have yet to see a time value used that displayed seconds (SS) without minutes.&lt;/P&gt;
&lt;P&gt;Datepart would only work on a DATETIME value and not something that is character, so you are skipping several steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The appearance of character values from Import would make one suspect that some of the cells have other text OR that the values in the spreadsheet were a mix of character and numeric date-time values with an Excel format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the most common questions on this forum relates to spreadsheet files and Import having issues because the spreadsheets impose NO restriction on the data values. Import examines a few rows and tries to guess properties, if the data is problematic then the result is problematic. A common solution is to File Save-As the file to a CSV file format and read that. Sometimes examining that CSV with a text editor like Notepad (NOT Excel) will reveal interesting things.&lt;/P&gt;
&lt;P&gt;Import that csv. look at the data step code generated by the procedure that appears in the log. It is often a good idea to copy the generated code, paste into the editor and modify it.&lt;/P&gt;
&lt;P&gt;Tell SAS to use a large Guessingrows option to examine more rows of the file before guessing what the variable characteristics are.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Oct 2023 20:33:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-10-13T20:33:10Z</dc:date>
    <item>
      <title>Importing xlsx data into SAS changed date variable format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-xlsx-data-into-SAS-changed-date-variable-format/m-p/898536#M355146</link>
      <description>&lt;DIV class=""&gt;I imported an excel file with date information enclosed as a format of mm/dd/yyyy hh:ss&amp;nbsp; (e.g. 08/24/2022 14:09) in Excel.&amp;nbsp;After importing into SAS, the format changed automatically&amp;nbsp;into a series of numbers and variable type is&amp;nbsp;character. I converted numeric variables into dates using datepart and DATE9. format. However, I got the different date for the same record. e.g. 08/24/2022 14:09 changed to 25AUG2082.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I would like to keep the original date information and format. Does anyone know how this can be done? I've tried input/put and datepart functions.&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Oct 2023 19:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-xlsx-data-into-SAS-changed-date-variable-format/m-p/898536#M355146</guid>
      <dc:creator>RBERG</dc:creator>
      <dc:date>2023-10-13T19:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Importing xlsx data into SAS changed date variable format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-xlsx-data-into-SAS-changed-date-variable-format/m-p/898545#M355150</link>
      <description>&lt;P&gt;Since you didn't show any of the code that you used to "convert" the values there isn't much to address on that part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How sure are you of this description: mm/dd/yyyy hh:ss ? I have yet to see a time value used that displayed seconds (SS) without minutes.&lt;/P&gt;
&lt;P&gt;Datepart would only work on a DATETIME value and not something that is character, so you are skipping several steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The appearance of character values from Import would make one suspect that some of the cells have other text OR that the values in the spreadsheet were a mix of character and numeric date-time values with an Excel format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the most common questions on this forum relates to spreadsheet files and Import having issues because the spreadsheets impose NO restriction on the data values. Import examines a few rows and tries to guess properties, if the data is problematic then the result is problematic. A common solution is to File Save-As the file to a CSV file format and read that. Sometimes examining that CSV with a text editor like Notepad (NOT Excel) will reveal interesting things.&lt;/P&gt;
&lt;P&gt;Import that csv. look at the data step code generated by the procedure that appears in the log. It is often a good idea to copy the generated code, paste into the editor and modify it.&lt;/P&gt;
&lt;P&gt;Tell SAS to use a large Guessingrows option to examine more rows of the file before guessing what the variable characteristics are.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 20:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-xlsx-data-into-SAS-changed-date-variable-format/m-p/898545#M355150</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-13T20:33:10Z</dc:date>
    </item>
  </channel>
</rss>

