<?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: Converting a numeric, non-integer year value to a SAS date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386045#M92429</link>
    <description>&lt;P&gt;Thank you for the reply. So that I am understanding correctly, I am basically calculating the non-integer difference in years between my date and the SAS reference date, then&amp;nbsp;converting it to integer days?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is straight forward. I appreciate it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Aug 2017 14:56:32 GMT</pubDate>
    <dc:creator>jdgriffin</dc:creator>
    <dc:date>2017-08-07T14:56:32Z</dc:date>
    <item>
      <title>Converting a numeric, non-integer year value to a SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/385996#M92408</link>
      <description>&lt;P&gt;I am working with a small dataset (see attached) that has time coded into fractional years. For example: 1990.1456, 1991.3568, 1991.5689...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an INFORMAT that would allow me to read&amp;nbsp;this variable in as a SAS date?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you can offer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-John&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 13:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/385996#M92408</guid>
      <dc:creator>jdgriffin</dc:creator>
      <dc:date>2017-08-07T13:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric, non-integer year value to a SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386002#M92411</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input dateval;
dateval = round((dateval - 1960) * 365.2425,1);
format dateval yymmddd10.;
cards;
1990.1456
1991.3568
1991.5689
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Aug 2017 13:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386002#M92411</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-07T13:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric, non-integer year value to a SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386014#M92418</link>
      <description>&lt;P&gt;There is no such informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However,&amp;nbsp; you could calculate the date value (or is it really a datetime value?), by&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Extract the year portion, i.e. the integer&lt;/LI&gt;
&lt;LI&gt;Take the decimal portion and determine the corresponding datetime&amp;nbsp;and multply by&amp;nbsp;24*60*60*(365 or 366) to get number of seconds into the&amp;nbsp; year if you want date-time values.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  year=floor(time);

  /* Get number of seconds in the year, accomodating leap years */
  secondsinyear=24*60*60*intck('day',mdy(1,1,year),mdy(1,1,year+1));

  datetimevalue=dhms(mdy(1,1,year),0,0,0) +
                secondsinyear*mod(time,1);

  datevalue=datepart(datetimevalue);
  format datetimevalue datetime20. datevalue date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 13:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386014#M92418</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-08-07T13:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric, non-integer year value to a SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386045#M92429</link>
      <description>&lt;P&gt;Thank you for the reply. So that I am understanding correctly, I am basically calculating the non-integer difference in years between my date and the SAS reference date, then&amp;nbsp;converting it to integer days?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is straight forward. I appreciate it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 14:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386045#M92429</guid>
      <dc:creator>jdgriffin</dc:creator>
      <dc:date>2017-08-07T14:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a numeric, non-integer year value to a SAS date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386047#M92430</link>
      <description>&lt;P&gt;Thanks for the reply. I suppose you are correct that it could be considered a datetime given its level of accuracy. I'll be sure to give this a try as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2017 14:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-a-numeric-non-integer-year-value-to-a-SAS-date/m-p/386047#M92430</guid>
      <dc:creator>jdgriffin</dc:creator>
      <dc:date>2017-08-07T14:58:00Z</dc:date>
    </item>
  </channel>
</rss>

