<?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: Correctly converting to DATETIME20.? in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91952#M943</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems that you are confusing SAS date and datetime concepts.&lt;/P&gt;&lt;P&gt;A SAS date contains the number of days since 1/1 1960.&lt;/P&gt;&lt;P&gt;A SAS datetime contains number of seconds since 1/1 1960.&lt;/P&gt;&lt;P&gt;It seems that you don'r have thje time part of man_nylig and tir_forrige. I guessing that you need to see if last_update is between those two.&lt;/P&gt;&lt;P&gt;Either use datepart() function on last_updated, or add some time constants to the other two.&lt;BR /&gt;%let man_nylig = %sysfunc(intnx(week1.3,%sysfunc(today()),0,b),DATE.):23:59:59;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2012 11:39:31 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2012-10-11T11:39:31Z</dc:date>
    <item>
      <title>Correctly converting to DATETIME20.?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91950#M941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The LAST_UPDATED variable has the format DATETIME20. and appears as this: 05OCT2012:00:00:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got two date variables from this month that I need to be able to compare with LAST_UPDATED, but have trouble setting them up in the correctly. For some reason, when I use the DATETIME20. format for them, they appear like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01JAN1960:05:21:15&lt;/P&gt;&lt;P&gt;01JAN1960:05:21:08&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both values are from October this year. How do I "translate them correctly" to work as DATETIME20. values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that generates the current variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let man_nylig = %sysfunc(intnx(week1.3,%sysfunc(today()),0,b),DATETIME20.);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let tir_forrige = %sysfunc(intnx(week1.3,%sysfunc(today()),-1,b),DATETIME20.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They appear as correct recent dates when I use other formats, such as &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;nordfde9&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 07:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91950#M941</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2012-10-11T07:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Correctly converting to DATETIME20.?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91951#M942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it might work to add "dt" to the week variable, but it didn't. I've tried countless other things, as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically my problem is: How do I transform raw time data, such as 19275 and 19268 (which I get if I don't include the DATETIME20-part in the code above), into functioning DATETIME20 in a macro? The current code seems to only add the raw time data into the time-part of datetime. I can resolve this if working in a DATA step, but I can't make it work in a macro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 11:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91951#M942</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2012-10-11T11:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Correctly converting to DATETIME20.?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91952#M943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems that you are confusing SAS date and datetime concepts.&lt;/P&gt;&lt;P&gt;A SAS date contains the number of days since 1/1 1960.&lt;/P&gt;&lt;P&gt;A SAS datetime contains number of seconds since 1/1 1960.&lt;/P&gt;&lt;P&gt;It seems that you don'r have thje time part of man_nylig and tir_forrige. I guessing that you need to see if last_update is between those two.&lt;/P&gt;&lt;P&gt;Either use datepart() function on last_updated, or add some time constants to the other two.&lt;BR /&gt;%let man_nylig = %sysfunc(intnx(week1.3,%sysfunc(today()),0,b),DATE.):23:59:59;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 11:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91952#M943</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2012-10-11T11:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Correctly converting to DATETIME20.?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91953#M944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91953#M944</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2012-10-11T12:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Correctly converting to DATETIME20.?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91954#M945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your original thought of putting 'dt' in front of 'week1.3' is close, however you also need to change today() (the current date) to datetime() (the current datetime).&amp;nbsp; Applying both these changes will make your code work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Correctly-converting-to-DATETIME20/m-p/91954#M945</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2012-10-11T12:18:52Z</dc:date>
    </item>
  </channel>
</rss>

