<?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: Date conversion to iso 8601 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520137#M140998</link>
    <description>&lt;P&gt;Here's an example, I broke it down into individual steps to help explain. You want to convert your date value into a SAS date value and then apply a ISO8601 format to it&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dates ;
	length cDate $9 ;
	/* read in the character date value */
	input charDate $11. ;
	/* break the day month &amp;amp; year into seperate parts */
	cDay=scan(charDate,1,"/") ;
	cMonth=scan(charDate,2,"/") ;
	cYear=scan(charDate,3,"/") ;
	/* Change any UN values to 01 (day) JAN (month) */
	if cDay="UN" then
		cDay="01" ;
	if cMonth="UN" then
		cMonth="JAN" ;
	/* Create a character value in the format DDMONYYYY e.g. 10DEC2018 */
	cDate=trim(cDay)!!trim(cMonth)!!trim(cyear) ;
	/* Convert character value to a SAS Date Value */
	sasDate=inputn(cDate,"date9.") ;
	/* Create a character value from the SAS date value using a ISO 8601 SAS format */
	iso8061Date=putn(sasDate,"B8601DA.") ;
cards ;
UN/JAN/2017
UN/NOV/2017
UN/APR/2017
UN/UN/2017
;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Dec 2018 20:27:10 GMT</pubDate>
    <dc:creator>AMSAS</dc:creator>
    <dc:date>2018-12-10T20:27:10Z</dc:date>
    <item>
      <title>Date conversion to iso 8601</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520101#M140988</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone suggest me method to convert partial date in ISO8601 date format.Please see the below examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UN/JAN/2017&lt;BR /&gt;UN/NOV/2017&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;UN/APR/2017&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;UN/UN/2017&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks in Adavance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 18:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520101#M140988</guid>
      <dc:creator>rakeshvvv</dc:creator>
      <dc:date>2018-12-10T18:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion to iso 8601</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520134#M140997</link>
      <description>&lt;P&gt;Make up a rule for replacing the 'UN' parts with default or specially calculated values. After replacing, and removing the slashes with compress(), you can use the date9. informat and assign the e8601da10. format for display.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 20:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520134#M140997</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-10T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion to iso 8601</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520137#M140998</link>
      <description>&lt;P&gt;Here's an example, I broke it down into individual steps to help explain. You want to convert your date value into a SAS date value and then apply a ISO8601 format to it&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dates ;
	length cDate $9 ;
	/* read in the character date value */
	input charDate $11. ;
	/* break the day month &amp;amp; year into seperate parts */
	cDay=scan(charDate,1,"/") ;
	cMonth=scan(charDate,2,"/") ;
	cYear=scan(charDate,3,"/") ;
	/* Change any UN values to 01 (day) JAN (month) */
	if cDay="UN" then
		cDay="01" ;
	if cMonth="UN" then
		cMonth="JAN" ;
	/* Create a character value in the format DDMONYYYY e.g. 10DEC2018 */
	cDate=trim(cDay)!!trim(cMonth)!!trim(cyear) ;
	/* Convert character value to a SAS Date Value */
	sasDate=inputn(cDate,"date9.") ;
	/* Create a character value from the SAS date value using a ISO 8601 SAS format */
	iso8061Date=putn(sasDate,"B8601DA.") ;
cards ;
UN/JAN/2017
UN/NOV/2017
UN/APR/2017
UN/UN/2017
;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 20:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-conversion-to-iso-8601/m-p/520137#M140998</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2018-12-10T20:27:10Z</dc:date>
    </item>
  </channel>
</rss>

