<?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 DATETIME20 Results based on last 12 hours of data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325100#M72266</link>
    <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question that's stumping me, more than likely a very simple answer, however I haven't been able to come up with a working solution as of yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I create a SAS7BDAT file that SAS writes data to, for each program we run (Logging start time, date, filename, End time and a list of activities (0000 for example would mean the program initiated, 9999 Means it ended). The format it write in is delimited with a ",".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is when I'm reading in the file (No issues up to, and just after reading in the SAS7BDAT). I'm trying to hold information in a dataset of ONLY&amp;nbsp;the programs that have run in the last 12 hours.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*IMPORTANT*&lt;/P&gt;&lt;P&gt;The Date format being read in is in DATETIME20. Format (Which needs to remain the same).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What has been suggested, though not sure how to work a variable in instead of datalines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format seconds minutes hours days weeks datetime20.;&lt;BR /&gt;format t_seconds t_minutes t_hours time9.;&lt;BR /&gt;&lt;BR /&gt;hours=intnx('hour', '&amp;amp;DATE_FROM'dt, -12);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2017 19:08:22 GMT</pubDate>
    <dc:creator>XMonsterX</dc:creator>
    <dc:date>2017-01-16T19:08:22Z</dc:date>
    <item>
      <title>DATETIME20 Results based on last 12 hours of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325100#M72266</link>
      <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question that's stumping me, more than likely a very simple answer, however I haven't been able to come up with a working solution as of yet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I create a SAS7BDAT file that SAS writes data to, for each program we run (Logging start time, date, filename, End time and a list of activities (0000 for example would mean the program initiated, 9999 Means it ended). The format it write in is delimited with a ",".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is when I'm reading in the file (No issues up to, and just after reading in the SAS7BDAT). I'm trying to hold information in a dataset of ONLY&amp;nbsp;the programs that have run in the last 12 hours.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*IMPORTANT*&lt;/P&gt;&lt;P&gt;The Date format being read in is in DATETIME20. Format (Which needs to remain the same).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What has been suggested, though not sure how to work a variable in instead of datalines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format seconds minutes hours days weeks datetime20.;&lt;BR /&gt;format t_seconds t_minutes t_hours time9.;&lt;BR /&gt;&lt;BR /&gt;hours=intnx('hour', '&amp;amp;DATE_FROM'dt, -12);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 19:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325100#M72266</guid>
      <dc:creator>XMonsterX</dc:creator>
      <dc:date>2017-01-16T19:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME20 Results based on last 12 hours of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325103#M72267</link>
      <description>&lt;P&gt;Macro variables are not resolved inside single quotes; use double quotes instead.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 19:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325103#M72267</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-16T19:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME20 Results based on last 12 hours of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325107#M72269</link>
      <description>&lt;P&gt;If you want &lt;STRONG&gt;exactly&lt;/STRONG&gt; 12 hourse add an option to the INTNX function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;start_time =&amp;nbsp;&lt;SPAN&gt;intnx('hour', '&amp;amp;DATE_FROM'dt, -12&lt;STRONG&gt;,same&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The option "same" means same at seconds accuracy &amp;nbsp;as end_time.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 19:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325107#M72269</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-01-16T19:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME20 Results based on last 12 hours of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325108#M72270</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;So of course, the second I finished sending this, I figured it out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though, I would still like to see what others come up with. But if anyone is wondering how I did it (Though I wont include my main code, I will show my solution).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET SE = %SYSFUNC(PUTN(%SYSEVALF(%SYSFUNC(DATETIME())),DATETIME20.3));&lt;/P&gt;&lt;P&gt;DAta temp.DEF;&lt;BR /&gt;SE = "&amp;amp;SE." ;&lt;BR /&gt;format seconds minutes hours days weeks datetime20.;&lt;BR /&gt;hours=intnx('hour', "' &amp;amp;SE. '"dt, -12);&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 19:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325108#M72270</guid>
      <dc:creator>XMonsterX</dc:creator>
      <dc:date>2017-01-16T19:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME20 Results based on last 12 hours of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325109#M72271</link>
      <description>&lt;P&gt;Thanks Shmuel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like the same part! Also it's actually not single quotes, or double. Thats where I was going wrong. It's wrapped in Double then single quotes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Monster&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 19:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME20-Results-based-on-last-12-hours-of-data/m-p/325109#M72271</guid>
      <dc:creator>XMonsterX</dc:creator>
      <dc:date>2017-01-16T19:33:07Z</dc:date>
    </item>
  </channel>
</rss>

