<?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: Prior and Post in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162726#M42260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be careful how you answer Fareeza'a question.&amp;nbsp; It isn't a factor if your times are all zero but, if they do represent actual times, you could be misclassifying the differences.&amp;nbsp; The following does consider time to be relevant:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat date first_date datetime21.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date first_date datetime21.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat test_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format test_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input test_date span;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first_date=dhms(test_date,0,0,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; date=dhms(test_date+span,0,0,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*date is WITHIN 5 days prior to the first_date*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; prior=-5*60*60*24 le date-first_date le 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*date is WITHIN 5 days post to the first_date*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; post=0 le date-first_date le 5*60*60*24;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;03DEC2013 4&lt;/P&gt;&lt;P&gt;03DEC2013 6&lt;/P&gt;&lt;P&gt;03DEC2013 -4&lt;/P&gt;&lt;P&gt;03DEC2013 -6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If time really isn't relevant, and aren't all represented with zeros, than I'd suggest changing the formulas to compare the dateparts of the two fields and not adjusted for seconds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Dec 2013 18:29:16 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2013-12-03T18:29:16Z</dc:date>
    <item>
      <title>Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162721#M42255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is my interpretation correct&lt;/P&gt;&lt;P&gt;if first date is 20th.could someone explain to me with example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*date is WITHIN&lt;STRONG&gt; 5 days prior&lt;/STRONG&gt; to the first_date*/&lt;/P&gt;&lt;P&gt;if date ge (first_date - 60*60*24*5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*date is WITHIN &lt;STRONG&gt;5 days post&lt;/STRONG&gt; to the first_date*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if date le (first_date + 60*60*24*5) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162721#M42255</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-12-03T16:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162722#M42256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If first_date is a datetime field, the comparisons are just adding or subtracting the number of seconds elapsed before or after a given date.&amp;nbsp; However, neither is accounting for WITHIN a given time period as such a comparison would require three dates to be compared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162722#M42256</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-12-03T16:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162723#M42257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first_date is a datetime field. and date is also date time field&lt;/P&gt;&lt;P&gt;i have two datetimess: date and first_date&lt;/P&gt;&lt;P&gt;i want to see if date is within +/- 5 days of first_date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the below is for +5 or -5????&lt;/P&gt;&lt;P&gt;if date ge (first_date - 60*60*24*5)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162723#M42257</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-12-03T16:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162724#M42258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is time a factor for these date time comparisons? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162724#M42258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-12-03T16:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162725#M42259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162725#M42259</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-12-03T16:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Prior and Post</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162726#M42260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be careful how you answer Fareeza'a question.&amp;nbsp; It isn't a factor if your times are all zero but, if they do represent actual times, you could be misclassifying the differences.&amp;nbsp; The following does consider time to be relevant:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat date first_date datetime21.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date first_date datetime21.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat test_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format test_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input test_date span;&lt;/P&gt;&lt;P&gt;&amp;nbsp; first_date=dhms(test_date,0,0,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; date=dhms(test_date+span,0,0,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*date is WITHIN 5 days prior to the first_date*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; prior=-5*60*60*24 le date-first_date le 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*date is WITHIN 5 days post to the first_date*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; post=0 le date-first_date le 5*60*60*24;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;03DEC2013 4&lt;/P&gt;&lt;P&gt;03DEC2013 6&lt;/P&gt;&lt;P&gt;03DEC2013 -4&lt;/P&gt;&lt;P&gt;03DEC2013 -6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If time really isn't relevant, and aren't all represented with zeros, than I'd suggest changing the formulas to compare the dateparts of the two fields and not adjusted for seconds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 18:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Prior-and-Post/m-p/162726#M42260</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-12-03T18:29:16Z</dc:date>
    </item>
  </channel>
</rss>

