<?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: Date Differences in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257849#M49557</link>
    <description>&lt;P&gt;Have the visit date from the previous observation stored in a retained variable, and use that as part of the calculation for the next visit date.&lt;/P&gt;</description>
    <pubDate>Sun, 20 Mar 2016 16:19:19 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-03-20T16:19:19Z</dc:date>
    <item>
      <title>Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257840#M49556</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find out the future date from the current date with 'x' number of days. the data is as follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2381i17B8152891C4D47E/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="4.jpg" title="4.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to add the number of days mentioned in the 'Count' column in the 'Visit Date' column and it should be stored in Next Visit date Column&amp;nbsp;if the visit date for the current visit is not mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. - The Patient 101 is having visit date till visit no 4 (21-Jan-16) then to find out his next visit date (for visit no 5), I want the '28' (from count variable) to be added in his visit number 4 date i.e. 21-jan-16 and stored it in 'Next Visit Date' column (21-jan-16 + 28 = 18-Feb-16). if his next visit date (i.e. visit 6) is also missing then the next corresponding count value to be added in 'Next Visit Date' column (18-Feb-16 + 28 = 17-Mar-16) and it is stored in 'Next Visit Date' column and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the patient 102 only has one visit date then I want to find out His Next Visit Dates based on the count mentioned in the corresponding observation till visit no 6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final result should look like as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2382i7E3DA0EE92D609C4/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="5.jpg" title="5.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Mar 2016 15:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257840#M49556</guid>
      <dc:creator>VikrantSawatkar</dc:creator>
      <dc:date>2016-03-20T15:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257849#M49557</link>
      <description>&lt;P&gt;Have the visit date from the previous observation stored in a retained variable, and use that as part of the calculation for the next visit date.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Mar 2016 16:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257849#M49557</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-20T16:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257864#M49558</link>
      <description>&lt;P&gt;Just a note. Posting your data as a picture will not get you a tested solution. My SAS doesn't read pictures.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Mar 2016 19:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257864#M49558</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-20T19:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257890#M49569</link>
      <description>&lt;P&gt;Yeah. Nobody like picture. Nobody would like to type it for you . Post it in text and better is SAS code .&lt;/P&gt;
&lt;P&gt;Next time ,don't forget it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input patient visitno visitdate : date9. count;
format visitdate  date9. ;
cards;
101 1 1jan16 1
101 2 2jan16 6
101 3 8jan16 7
101 4 21jan16 13
101 5 . 28
101 6 . 28
101 7 . 28
102 1 1feb16 1
102 2 . 6
;
run;

data want;
 set have;
 by patient ;
 retain temp;
 if first.patient then call missing(temp);
 if not missing(visitdate) then newvisitdate=visitdate;
  else newvisitdate=temp+count;
 temp=newvisitdate;
 drop temp;
 format newvisitdate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Mar 2016 01:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257890#M49569</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-21T01:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257898#M49570</link>
      <description>Please accept my apologies. I will not post images hereafter.&lt;BR /&gt;&lt;BR /&gt;Thank you very much for your help.&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Mon, 21 Mar 2016 02:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/257898#M49570</guid>
      <dc:creator>VikrantSawatkar</dc:creator>
      <dc:date>2016-03-21T02:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/258100#M49652</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17377"&gt;@VikrantSawatkar﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have verified that Ksharp's suggestion solves your problem, it would be good if you marked his reply as the accepted solution (by clicking the &lt;U&gt;respective&lt;/U&gt; button "Accept as Solution"). Please see &lt;A href="https://communities.sas.com/t5/Community-Memo/Importance-of-Accepted-Solutions-and-Likes/ba-p/234370" target="_blank"&gt;this article&lt;/A&gt; why this is important.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 21:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/258100#M49652</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-21T21:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259787#M50305</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;for the help. It is working perfectly.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2016 16:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259787#M50305</guid>
      <dc:creator>VikrantSawatkar</dc:creator>
      <dc:date>2016-03-29T16:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259793#M50308</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17377"&gt;@VikrantSawatkar﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are "Accept as Solution" buttons in every post and, of course, you should click the one pertaining to the solution. That's why I underlined the word "respective" in '&lt;EM&gt;by clicking the &lt;U&gt;respective&lt;/U&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt; button "Accept as Solution&lt;/EM&gt;"'. Unfortunately, you still managed to click the wrong button. Not sure if you can change it. But you could at least give likes to the actual solution (by pressing the &lt;U&gt;&lt;STRONG&gt;respective&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;orange "applause" button).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Edit: Maybe Super Users or community administrators (&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger﻿&lt;/a&gt;?)&amp;nbsp;can correct this.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2016 17:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259793#M50308</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-29T17:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259809#M50316</link>
      <description>&lt;P&gt;The super users don't seem to have that power. I think the op can un-accept a solution by clicking the "Not the solution" choice on the wrong answer's menu. (untested)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2016 17:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259809#M50316</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-29T17:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259826#M50326</link>
      <description>&lt;P&gt;I am sorry. I'm a new user here. And I was not aware of it. &amp;nbsp;Next time onwards, &amp;nbsp;I will keep it in my mind.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, &amp;nbsp;the solution provided by Ksharp is correct. I'm able to get the desired results with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2016 18:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/259826#M50326</guid>
      <dc:creator>VikrantSawatkar</dc:creator>
      <dc:date>2016-03-29T18:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date Differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/260081#M50411</link>
      <description>Done - &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; now has the correct solution.</description>
      <pubDate>Wed, 30 Mar 2016 13:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Differences/m-p/260081#M50411</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-03-30T13:39:02Z</dc:date>
    </item>
  </channel>
</rss>

