<?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: Difference between two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795526#M255186</link>
    <description>Hello, &lt;BR /&gt;Why don’t I say  if difference is &amp;gt; 0 and &amp;lt;= 30?&lt;BR /&gt;And should I find the difference first and then bring if?&lt;BR /&gt;Respectfully,&lt;BR /&gt;Blueblue</description>
    <pubDate>Thu, 10 Feb 2022 16:39:50 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2022-02-10T16:39:50Z</dc:date>
    <item>
      <title>Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795418#M255141</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to find out if DateofService that are within 30 days of the dischargedate.&lt;/P&gt;
&lt;P&gt;I appreciate your help.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 04:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795418#M255141</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-10T04:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795419#M255142</link>
      <description>&lt;P&gt;If they both contain DATE values then just test is the absolute value of the difference is less than or equal to 30.&lt;/P&gt;
&lt;P&gt;Make sure to protect against missing values and SAS will consider a missing value as less than any actual number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if -1 &amp;lt; abs(DateofService-dischargedate) &amp;lt;= 30 then .....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Feb 2022 04:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795419#M255142</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-10T04:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795423#M255143</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;Thanks for your response.&amp;nbsp;&lt;BR /&gt;why should I use abs?&lt;BR /&gt;if dateofservice is less than discharge date, then that is ok. We want to find out those records when they had a visit within 30 days after their discharge.&lt;/P&gt;
&lt;P&gt;if we use abs, then we can’t find out within 30 days after thr discharge date.&lt;/P&gt;
&lt;P&gt;can’t we use datedif?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how should I guard against missing values? If discaregedate or dateofservice ne.?&lt;/P&gt;
&lt;P&gt;yes both values are dates. I think if the result is positive, then dos has occurred after discharge date. Then, I need to find out if it is between 0 to 30 days.&lt;/P&gt;
&lt;P&gt;regards&amp;nbsp;&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 05:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795423#M255143</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-10T05:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795430#M255147</link>
      <description>&lt;P&gt;Just swap your variables then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if 1 &amp;lt;= (dischargedate - DateofService) &amp;lt;= 30;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not sure what happens if both happen on the same day. Do you want to count those? If so change the 1 to 0.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 07:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795430#M255147</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-02-10T07:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795433#M255148</link>
      <description>&lt;P&gt;All your questions regarding date values are answered here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/basess/p0er6damfbjifwn1ih1b1tacw5zj.htm" target="_blank" rel="noopener"&gt;Working with Dates in the SAS System&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Studying these documents will make most of your date-related posts here unnecessary.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 07:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795433#M255148</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-10T07:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795526#M255186</link>
      <description>Hello, &lt;BR /&gt;Why don’t I say  if difference is &amp;gt; 0 and &amp;lt;= 30?&lt;BR /&gt;And should I find the difference first and then bring if?&lt;BR /&gt;Respectfully,&lt;BR /&gt;Blueblue</description>
      <pubDate>Thu, 10 Feb 2022 16:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795526#M255186</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-10T16:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795539#M255188</link>
      <description>&lt;P&gt;Because you asked for "&lt;SPAN&gt;within 30 days", which would imply plus or minus 30 days.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 17:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795539#M255188</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-10T17:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795556#M255196</link>
      <description>&lt;P&gt;&lt;SPAN&gt;"Why don’t I say if difference is &amp;gt; 0 and &amp;lt;= 30?"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You'll get the same results as in my logic.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"And should I find the difference first and then bring if?"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Up to you, which ever way is best for you. There is no right or wrong answer here.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 19:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795556#M255196</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-02-10T19:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795793#M255281</link>
      <description>&lt;P&gt;Hello Kurt,&lt;/P&gt;
&lt;P&gt;What you have directed me are links after links. If I want to get that route, I would be lost and each day, I need to start working in a new company. Obviously, reading is essential part of gaining education, I always read and search and then I post my question here.&lt;/P&gt;
&lt;P&gt;I clicked on the links then other links came up and then till seven layers deep that I forgot what I wanted.&lt;/P&gt;
&lt;P&gt;Anyway, thank you for sending me the direction that I go back and read them after I deliver my projects. I have short deadlines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;Blue &amp;amp; Blue&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 21:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-two-dates/m-p/795793#M255281</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-11T21:44:46Z</dc:date>
    </item>
  </channel>
</rss>

