<?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: Format &amp;quot;dd-mm-yyyy&amp;quot; character date to numeric mmddyy10. format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703202#M215442</link>
    <description>&lt;P&gt;That worked! Thank you so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 21:11:21 GMT</pubDate>
    <dc:creator>claremc</dc:creator>
    <dc:date>2020-12-02T21:11:21Z</dc:date>
    <item>
      <title>Format "dd-mm-yyyy" character date to numeric mmddyy10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703195#M215438</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out how to format a character variable of a date that appears in the character format "8-Jun-2020" to a numeric mmddyy10 variable: "06/08/2020". I tried to use "substr" and "put", but the issue is that some dates appear as "22-Jun-2020", so the day part of the variable takes up 2 spaces instead of one (22 vs. 8).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Things I've tried:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data import;
set import;
birth_date_new = catx("-", put(birth_date, mmddyy10.)); 
run; &lt;/PRE&gt;&lt;P&gt;AND&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data import; 
set import; 
birth_date_new= catx("-", substr(birth_date, 3,3),substr(birth_date, 1,1),substr(birth_date, 7,4)) OR
birth_date_new = catx("-", substr(birth_date,3,3), substr(birth_date,1,2), substr(birth_date,8,4));
format birth_date mmddyyyy10.; 
run;&lt;/PRE&gt;&lt;P&gt;Let me know if you can help, thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clare&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 20:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703195#M215438</guid>
      <dc:creator>claremc</dc:creator>
      <dc:date>2020-12-02T20:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Format "dd-mm-yyyy" character date to numeric mmddyy10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703198#M215439</link>
      <description>&lt;P&gt;If your date variable is indeed character to start with this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  date = '01-12-2020';
  date_new = input(date, ddmmyy10.);
  format date_new mmddyyd10.;
  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Dec 2020 20:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703198#M215439</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-12-02T20:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Format "dd-mm-yyyy" character date to numeric mmddyy10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703200#M215441</link>
      <description>&lt;P&gt;Don't do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data import;
set import;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If something untoward happens in the data step, the dataset is destroyed and you need to re-create it. Sometimes this might mean you have to look for a backup.&lt;/P&gt;
&lt;P&gt;Do this to convert your date value:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;birth_date_new = input(birth_date,date11.); 
format birth_date_new mmddyy10.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Dec 2020 21:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703200#M215441</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-02T21:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Format "dd-mm-yyyy" character date to numeric mmddyy10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703202#M215442</link>
      <description>&lt;P&gt;That worked! Thank you so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 21:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-quot-dd-mm-yyyy-quot-character-date-to-numeric-mmddyy10/m-p/703202#M215442</guid>
      <dc:creator>claremc</dc:creator>
      <dc:date>2020-12-02T21:11:21Z</dc:date>
    </item>
  </channel>
</rss>

