<?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: summarizing subsequent data rows in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56080#M5876</link>
    <description>The LAG function provides the functionality that you are looking for.  It's available through the data step.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
    <pubDate>Wed, 22 Oct 2008 02:40:16 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2008-10-22T02:40:16Z</dc:date>
    <item>
      <title>summarizing subsequent data rows</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56079#M5875</link>
      <description>I am trying to summarize some medical claims data that is in multiple rows.  I want to flag or create a counter for any rows that have an admit date that is the same or within one day of the previous row's discharge date.  For instance:&lt;BR /&gt;
&lt;BR /&gt;
ID     Admit     Discharge      Counter&lt;BR /&gt;
X      1/1/2008        1/15/2008            1&lt;BR /&gt;
X      1/15/2008      1/30/2008            1&lt;BR /&gt;
X      1/31/2008      2/10/2008            1&lt;BR /&gt;
X      2/15/2008      2/30/2008            2&lt;BR /&gt;
&lt;BR /&gt;
Hope that makes sense.  The next and previous functions can do something similar to this in Crystal but I can't think of how to do it with SAS.  Any ideas?  Thanks!</description>
      <pubDate>Tue, 21 Oct 2008 23:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56079#M5875</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-21T23:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: summarizing subsequent data rows</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56080#M5876</link>
      <description>The LAG function provides the functionality that you are looking for.  It's available through the data step.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Wed, 22 Oct 2008 02:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56080#M5876</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2008-10-22T02:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: summarizing subsequent data rows</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56081#M5877</link>
      <description>Hey,&lt;BR /&gt;
&lt;BR /&gt;
Here is an example of using lag function to get what you looking for base on  your  example:&lt;BR /&gt;
&lt;BR /&gt;
data temp (drop=ind num2 num3);&lt;BR /&gt;
length num3 $10.;&lt;BR /&gt;
input num1 $ num2 $10. num3 $;&lt;BR /&gt;
num22=input(num2,mmddyy10.); &lt;BR /&gt;
num33=input(num3,mmddyy10.);&lt;BR /&gt;
format num22 mmddyy10. num33 mmddyy10.;&lt;BR /&gt;
ind=lag(num33);&lt;BR /&gt;
if ind=num22 or ind=num22-1 then new=1;&lt;BR /&gt;
else if ind=. then new=1;&lt;BR /&gt;
else new=2;&lt;BR /&gt;
put _all_;&lt;BR /&gt;
cards;&lt;BR /&gt;
x 01/11/2008 01/15/2008&lt;BR /&gt;
x 01/15/2008 01/30/2008&lt;BR /&gt;
x 01/31/2008 02/10/2008&lt;BR /&gt;
x 02/15/2008 02/26/2008&lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 22 Oct 2008 21:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/summarizing-subsequent-data-rows/m-p/56081#M5877</guid>
      <dc:creator>yonib</dc:creator>
      <dc:date>2008-10-22T21:51:57Z</dc:date>
    </item>
  </channel>
</rss>

