<?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: Datetimes in the wrong format when importing csv files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917224#M361308</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/449384"&gt;@staplegunjelly&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello Everyone!&lt;/P&gt;
&lt;P&gt;This is for a personal project of mine. I need to aggregate a ton of csv files to get my data prepped.&lt;/P&gt;
&lt;P&gt;I have 2 datetime columns in my csv files which look like:&lt;/P&gt;
&lt;P&gt;datetime_beginning_utc,datetime_beginning_ept&lt;BR /&gt;2/11/2022 5:00:00 AM,2/11/2022 12:00:00 AM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The date part of these values are in the mm/dd/yyyy format. When using proc import, the datetimes are being stored as:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="staplegunjelly_0-1708541450074.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93977iD26827B491DB3990/image-size/medium?v=v2&amp;amp;px=400" role="button" title="staplegunjelly_0-1708541450074.png" alt="staplegunjelly_0-1708541450074.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Is there anyway to fix this? or any work arounds?&lt;/P&gt;
&lt;P&gt;I'm using SAS 9.4&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What about that is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you expected SAS to GUESS that by 2/11 you meant FEB 11th instead of 2nd of NOV then change the setting of the DATESTYLE system option from DMY to MDY before running PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or better still write your own program to read the CSV file and you can have full control over how the text strings are read.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2024 18:58:11 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-02-21T18:58:11Z</dc:date>
    <item>
      <title>Datetimes in the wrong format when importing csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917222#M361307</link>
      <description>&lt;P&gt;Hello Everyone!&lt;/P&gt;&lt;P&gt;This is for a personal project of mine. I need to aggregate a ton of csv files to get my data prepped.&lt;/P&gt;&lt;P&gt;I have 2 datetime columns in my csv files which look like:&lt;/P&gt;&lt;P&gt;datetime_beginning_utc,datetime_beginning_ept&lt;BR /&gt;2/11/2022 5:00:00 AM,2/11/2022 12:00:00 AM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date part of these values are in the mm/dd/yyyy format. When using proc import, the datetimes are being stored as:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="staplegunjelly_0-1708541450074.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93977iD26827B491DB3990/image-size/medium?v=v2&amp;amp;px=400" role="button" title="staplegunjelly_0-1708541450074.png" alt="staplegunjelly_0-1708541450074.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there anyway to fix this? or any work arounds?&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 18:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917222#M361307</guid>
      <dc:creator>staplegunjelly</dc:creator>
      <dc:date>2024-02-21T18:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Datetimes in the wrong format when importing csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917224#M361308</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/449384"&gt;@staplegunjelly&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello Everyone!&lt;/P&gt;
&lt;P&gt;This is for a personal project of mine. I need to aggregate a ton of csv files to get my data prepped.&lt;/P&gt;
&lt;P&gt;I have 2 datetime columns in my csv files which look like:&lt;/P&gt;
&lt;P&gt;datetime_beginning_utc,datetime_beginning_ept&lt;BR /&gt;2/11/2022 5:00:00 AM,2/11/2022 12:00:00 AM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The date part of these values are in the mm/dd/yyyy format. When using proc import, the datetimes are being stored as:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="staplegunjelly_0-1708541450074.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93977iD26827B491DB3990/image-size/medium?v=v2&amp;amp;px=400" role="button" title="staplegunjelly_0-1708541450074.png" alt="staplegunjelly_0-1708541450074.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Is there anyway to fix this? or any work arounds?&lt;/P&gt;
&lt;P&gt;I'm using SAS 9.4&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What about that is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you expected SAS to GUESS that by 2/11 you meant FEB 11th instead of 2nd of NOV then change the setting of the DATESTYLE system option from DMY to MDY before running PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or better still write your own program to read the CSV file and you can have full control over how the text strings are read.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 18:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917224#M361308</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-21T18:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Datetimes in the wrong format when importing csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917238#M361312</link>
      <description>I had no idea about the datastyle option. Thanks a lot! That did the job for me.&lt;BR /&gt;I also tried writing my own program but it worked differently across different csv files.</description>
      <pubDate>Wed, 21 Feb 2024 20:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimes-in-the-wrong-format-when-importing-csv-files/m-p/917238#M361312</guid>
      <dc:creator>staplegunjelly</dc:creator>
      <dc:date>2024-02-21T20:37:11Z</dc:date>
    </item>
  </channel>
</rss>

