<?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: dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326384#M72672</link>
    <description>&lt;P&gt;Thank you for the response. Actually i have two dates vch are the same and i need to output &amp;nbsp;'1' if the dates r same so i used (end_date-start_date)+1 but its giving a missing value.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 18:28:55 GMT</pubDate>
    <dc:creator>shynu</dc:creator>
    <dc:date>2017-01-20T18:28:55Z</dc:date>
    <item>
      <title>dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326372#M72668</link>
      <description>&lt;P&gt;How to calculate the difference between dates when both are character?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex: differnce b/w 01-15-2017 and 01-15-2017 is 'one'(1) &amp;nbsp;and both are chars. How to find the diff?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 18:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326372#M72668</guid>
      <dc:creator>shynu</dc:creator>
      <dc:date>2017-01-20T18:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326379#M72669</link>
      <description>&lt;P&gt;Convert to dates so the SAS date functions work. But first, how do you get a difference of one when both values are 01-15-2017?&lt;/P&gt;
&lt;P&gt;Also, do you want the difference in Days, weeks, months, years or something else?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 18:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326379#M72669</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-20T18:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326383#M72671</link>
      <description>&lt;P&gt;I recommend the paper &lt;A href="http://www2.sas.com/proceedings/sugi25/25/btu/25p058.pdf" target="_self"&gt;here&lt;/A&gt;- specifically the INPUT and INTCK functions. &amp;nbsp;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;indicated, not sure how you get 1 from the dates given, but the INPUT will convert it to the proper format and INTCK will calculate the difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 18:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326383#M72671</guid>
      <dc:creator>DarthPathos</dc:creator>
      <dc:date>2017-01-20T18:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326384#M72672</link>
      <description>&lt;P&gt;Thank you for the response. Actually i have two dates vch are the same and i need to output &amp;nbsp;'1' if the dates r same so i used (end_date-start_date)+1 but its giving a missing value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 18:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326384#M72672</guid>
      <dc:creator>shynu</dc:creator>
      <dc:date>2017-01-20T18:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326389#M72673</link>
      <description>&lt;P&gt;After looking at the links suggested by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3062"&gt;@DarthPathos&lt;/a&gt;&amp;nbsp;calculate the interval. Then do a test if you need to modify the difference such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If difference=0 then difference = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure I could write a very convoluted one line calculation but it would look ugly or confusing, not be obvious and boil down to the added "if" statement in the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your variables are character then the - should have generated some notes similar to:&lt;/P&gt;
&lt;PRE&gt;NOTE: Invalid numeric data, end_date='01-01-2017' , at line 237 column 11.
NOTE: Invalid numeric data, start_date='01-01-2017' , at line 237 column 20.
end_date=01-01-2017 start_date=01-01-2017 diff=. _ERROR_=1 _N_=1
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 237:19
&lt;/PRE&gt;
&lt;P&gt;Which tells you that you cannot subtract character values (at least those that can not be easily converted to numeric which 01012017 could) and that "missing value" - "missing value" + 1 = "missing value".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 18:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326389#M72673</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-20T18:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326399#M72674</link>
      <description>&lt;P&gt;The initial calculation would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;difference = input(end_date, mmddyy10.) - input(start_date, mmddyy10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whether you want to add either of these is up to you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;difference = difference + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if difference = 0 then difference=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some "study day" calculations in clinical data that don't allow study day 0.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 20:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/326399#M72674</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-20T20:16:15Z</dc:date>
    </item>
  </channel>
</rss>

