<?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: Change the date and time format in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780454#M31629</link>
    <description>&lt;P&gt;I could not find a standard form for this, so I rolled one with PROC FORMAT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture mydate 
  low-high='%0d/%0m/%Y %0H:%0M:%0S' (datatype=datetime)
;
run;

data want;
input dt datetime16.;
format dt mydate.;
datalines;
12MAR20:11:37:13
21OCT20:20:48:00
06NOV20:20:15:00
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 16 Nov 2021 14:43:46 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-11-16T14:43:46Z</dc:date>
    <item>
      <title>Change the date and time format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780448#M31627</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset A:&lt;BR /&gt;12MAR20:11:37:13&lt;/P&gt;&lt;P&gt;21OCT20:20:48:00&lt;/P&gt;&lt;P&gt;06NOV20:20:15:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the dataset B;&lt;/P&gt;&lt;P&gt;03/21/2020 11:37:13&lt;/P&gt;&lt;P&gt;10/21/2020 20:48:00&lt;/P&gt;&lt;P&gt;11/06/2020 20:15:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I do this in SAS? if yes please let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 14:35:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780448#M31627</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2021-11-16T14:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change the date and time format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780452#M31628</link>
      <description>&lt;P&gt;If the variable is a proper datetime-variable then changing the format attached to the variable should solve the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 14:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780452#M31628</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-11-16T14:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change the date and time format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780454#M31629</link>
      <description>&lt;P&gt;I could not find a standard form for this, so I rolled one with PROC FORMAT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture mydate 
  low-high='%0d/%0m/%Y %0H:%0M:%0S' (datatype=datetime)
;
run;

data want;
input dt datetime16.;
format dt mydate.;
datalines;
12MAR20:11:37:13
21OCT20:20:48:00
06NOV20:20:15:00
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Nov 2021 14:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780454#M31629</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-16T14:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change the date and time format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780462#M31630</link>
      <description>&lt;P&gt;You must be a beginner because your question lacks a lot of necessary information to really give you an answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Making tons of assumptions: You've got a variable that when you look at it shows you a date in a specific datetime format. You want to change this format to something else.&lt;/P&gt;
&lt;P&gt;If above is true: SAS stores datetime formats in a numerical variable as the count of seconds since 1/1/1960. You then just need to apply a format to such a numerical variable so it prints this number in a human readable form. The only thing you need to do to in such a case is change the format applied to the variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS datetime formats that are available are documented &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/n0p2fmevfgj470n17h4k9f27qjag.htm" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your locale is set to US below format should work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*options locale=en_us;*/
data sample;
  dttm_internal_value=datetime();
  dttm_formatted=dttm_internal_value;
  format dttm_formatted nldatms.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...and as a semi-serious comment as a non-US person: The cost to the global economy and lives the US causes by still using MM/DD date formats and non-metric systems must be significant.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 15:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-date-and-time-format/m-p/780462#M31630</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-11-16T15:04:26Z</dc:date>
    </item>
  </channel>
</rss>

