<?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: Grouping observations by date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815819#M321991</link>
    <description>&lt;P&gt;You missed an important word in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;'s post:&amp;nbsp;&lt;U&gt;working&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;Your data step does not create a useful dataset, please correct it.&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2022 12:45:51 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-05-31T12:45:51Z</dc:date>
    <item>
      <title>Grouping observations by date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815738#M321967</link>
      <description>&lt;P&gt;Hello, I am working with a data set that includes multiple therapy days for patients and I am trying to group the therapy activities into two groups: admission and discharge based on whether they are a week within the admit or discharge dates for each person.&amp;nbsp; I am having trouble figuring out the best way to do this since I am unsure how to do it for each person.&amp;nbsp; The data is from Redcap and the therapy activities were done using a repeat variable so each therapy session is a separate row in the dataset and there are approximately 10-20 of these rows for each patient.&amp;nbsp; I hope this makes sense.&amp;nbsp; I have tried to use an if/then statement but it doesn't recognize that there are multiple patients and consolidates them all as a whole.&amp;nbsp; I'm kind of new with SAS but I am happy to clarify any questions if this doesn't make sense.&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample data:&lt;/P&gt;&lt;P&gt;data covid;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input recordid addate ddate actdate acttype;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 1/2/2020 3/3/2020 . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 . . 3/1/2020 1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 . . 1/3/2020 3&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 1/3/2020 3/4/2020 . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 . . 1/4/2020 4&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 . . 3/3/2020 5&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for each recordid there are many rows beneath it for different therapy activities for that person.&amp;nbsp; I need to categorize each therapy session (actdate) as 'admission' or 'discharge' based on whether they are a week within the addate (admission date) or a week within the ddate (discharge data).&amp;nbsp; And this needs to be done for each recordid.&amp;nbsp; So for the first one (recordid 1), the 1/3/2020 is a week within the addate (1/2/2020) and so needs to be categorized as 'admission'.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 00:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815738#M321967</guid>
      <dc:creator>eclaire</dc:creator>
      <dc:date>2022-05-31T00:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping observations by date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815741#M321968</link>
      <description>&lt;P&gt;Please provide sample data in the form of a working data step.&amp;nbsp; Then we can provide well-formed suggestions and can test any suggested program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And please show also what you want the result to look like, to assess any test program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help us help you.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 21:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815741#M321968</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-05-30T21:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping observations by date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815747#M321970</link>
      <description>&lt;P&gt;I just edited my post to include this, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 23:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815747#M321970</guid>
      <dc:creator>eclaire</dc:creator>
      <dc:date>2022-05-30T23:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping observations by date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815819#M321991</link>
      <description>&lt;P&gt;You missed an important word in &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;'s post:&amp;nbsp;&lt;U&gt;working&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;Your data step does not create a useful dataset, please correct it.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 12:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-observations-by-date/m-p/815819#M321991</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-31T12:45:51Z</dc:date>
    </item>
  </channel>
</rss>

