<?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 ISO8601 in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2150#M130</link>
    <description>In the same variable I have dates in the format YYYY-MM-DD and YYYY-MM-DDTHH:MM:SS&lt;BR /&gt;
&lt;BR /&gt;
I want to convert the date part of these values to a SAS date. Can I do this with 1 informat or do I have to do some data driven preprocessing to discard the time information in records that have a time part ?&lt;BR /&gt;
&lt;BR /&gt;
Example (with 2 different informats, depending on the data): &lt;BR /&gt;
&lt;BR /&gt;
DATA _null_; &lt;BR /&gt;
 FORMAT sasdate date9.; &lt;BR /&gt;
 isodate="2005-12-23T07:23:11"; &lt;BR /&gt;
 sasdate=DATEPART(INPUT(isodate, IS8601DT.)); &lt;BR /&gt;
 PUT sasdate=; &lt;BR /&gt;
 isodate="2005-12-23"; &lt;BR /&gt;
 sasdate=INPUT(isodate, IS8601DA.); &lt;BR /&gt;
 PUT sasdate=; &lt;BR /&gt;
RUN; &lt;BR /&gt;
&lt;BR /&gt;
sasdate=23DEC2005&lt;BR /&gt;
sasdate=23DEC2005&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Lex Jansen</description>
    <pubDate>Wed, 24 Jan 2007 19:07:10 GMT</pubDate>
    <dc:creator>Lex_SAS</dc:creator>
    <dc:date>2007-01-24T19:07:10Z</dc:date>
    <item>
      <title>ISO8601</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2150#M130</link>
      <description>In the same variable I have dates in the format YYYY-MM-DD and YYYY-MM-DDTHH:MM:SS&lt;BR /&gt;
&lt;BR /&gt;
I want to convert the date part of these values to a SAS date. Can I do this with 1 informat or do I have to do some data driven preprocessing to discard the time information in records that have a time part ?&lt;BR /&gt;
&lt;BR /&gt;
Example (with 2 different informats, depending on the data): &lt;BR /&gt;
&lt;BR /&gt;
DATA _null_; &lt;BR /&gt;
 FORMAT sasdate date9.; &lt;BR /&gt;
 isodate="2005-12-23T07:23:11"; &lt;BR /&gt;
 sasdate=DATEPART(INPUT(isodate, IS8601DT.)); &lt;BR /&gt;
 PUT sasdate=; &lt;BR /&gt;
 isodate="2005-12-23"; &lt;BR /&gt;
 sasdate=INPUT(isodate, IS8601DA.); &lt;BR /&gt;
 PUT sasdate=; &lt;BR /&gt;
RUN; &lt;BR /&gt;
&lt;BR /&gt;
sasdate=23DEC2005&lt;BR /&gt;
sasdate=23DEC2005&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Lex Jansen</description>
      <pubDate>Wed, 24 Jan 2007 19:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2150#M130</guid>
      <dc:creator>Lex_SAS</dc:creator>
      <dc:date>2007-01-24T19:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: ISO8601</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2151#M131</link>
      <description>Maybe I misunderstood your problem, but specifying in your informat that you only use the first 10 characters should behave in the same way with dates and datetimes, as in the example :&lt;BR /&gt;
&lt;BR /&gt;
DATA _null_; &lt;BR /&gt;
FORMAT sasdate date9.; &lt;BR /&gt;
isodate="2005-12-23T07:23:11"; &lt;BR /&gt;
sasdate=INPUT(isodate, IS8601DA10.); &lt;BR /&gt;
PUT sasdate=; &lt;BR /&gt;
isodate="2005-12-23"; &lt;BR /&gt;
sasdate=INPUT(isodate, IS8601DA10.); &lt;BR /&gt;
PUT sasdate=; &lt;BR /&gt;
RUN; &lt;BR /&gt;
&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Thu, 25 Jan 2007 09:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2151#M131</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-01-25T09:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: ISO8601</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2152#M132</link>
      <description>Thanks, Olivier.&lt;BR /&gt;
&lt;BR /&gt;
I did not think about that.&lt;BR /&gt;
&lt;BR /&gt;
Lex</description>
      <pubDate>Thu, 25 Jan 2007 13:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/ISO8601/m-p/2152#M132</guid>
      <dc:creator>Lex_SAS</dc:creator>
      <dc:date>2007-01-25T13:10:33Z</dc:date>
    </item>
  </channel>
</rss>

