<?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 SAS Tip: Convert CYYMMDD to a SAS date in PROC SQL in SAS Tips from the Community</title>
    <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Convert-CYYMMDD-to-a-SAS-date-in-PROC-SQL/m-p/490574#M192</link>
    <description>&lt;P&gt;In AS400 systems, the IBM date format can be transmitted in the format CYYMMDD, where the C indicates Century and is either a "0" to indicate a date earlier than 2000 or a "1" for dates thereafter. For example: 960412 = 4/12/1996, 1180809 = 8/9/2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To convert this date format to a SAS date, you can use the following line in your PROC SQL statements:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mdy(mod(&amp;lt;datefield&amp;gt;,10000)/100,mod((&amp;lt;datefield&amp;gt;,100),(&amp;lt;datefield&amp;gt;/10000) + 1900)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can also add a "format=" statement to return the value you're looking for, eg:&lt;/P&gt;&lt;PRE&gt;format = date9.&lt;/PRE&gt;&lt;P&gt;would return 09AUG2018,&lt;/P&gt;&lt;PRE&gt;format = mmddyys10.&lt;/PRE&gt;&lt;P&gt;would return 08/09/2018.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 18:37:15 GMT</pubDate>
    <dc:creator>mtgkooks</dc:creator>
    <dc:date>2018-08-28T18:37:15Z</dc:date>
    <item>
      <title>SAS Tip: Convert CYYMMDD to a SAS date in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Convert-CYYMMDD-to-a-SAS-date-in-PROC-SQL/m-p/490574#M192</link>
      <description>&lt;P&gt;In AS400 systems, the IBM date format can be transmitted in the format CYYMMDD, where the C indicates Century and is either a "0" to indicate a date earlier than 2000 or a "1" for dates thereafter. For example: 960412 = 4/12/1996, 1180809 = 8/9/2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To convert this date format to a SAS date, you can use the following line in your PROC SQL statements:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mdy(mod(&amp;lt;datefield&amp;gt;,10000)/100,mod((&amp;lt;datefield&amp;gt;,100),(&amp;lt;datefield&amp;gt;/10000) + 1900)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can also add a "format=" statement to return the value you're looking for, eg:&lt;/P&gt;&lt;PRE&gt;format = date9.&lt;/PRE&gt;&lt;P&gt;would return 09AUG2018,&lt;/P&gt;&lt;PRE&gt;format = mmddyys10.&lt;/PRE&gt;&lt;P&gt;would return 08/09/2018.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 18:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Convert-CYYMMDD-to-a-SAS-date-in-PROC-SQL/m-p/490574#M192</guid>
      <dc:creator>mtgkooks</dc:creator>
      <dc:date>2018-08-28T18:37:15Z</dc:date>
    </item>
  </channel>
</rss>

