<?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: Longitudinal data management - keeping only records based off dates in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549536#M16870</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234707"&gt;@Shad&lt;/a&gt;&amp;nbsp;what if the two dates were&amp;nbsp;&lt;SPAN&gt;12/26/2010, and on 12/28/2010? Would you still drop them?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 09:53:22 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-04-09T09:53:22Z</dc:date>
    <item>
      <title>Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549356#M16863</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with a longitudinal data set, and am trying to identify drugs administered to a patient. However, I'm only interested in patients who had no subsequent drugs prescriptions given. (i.e. if a patient was given drugs on date 12/26/2010, and on 12/27/2010 I want to drop them).&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;

input Medical_Record_Number    Generic_Drug      date_of_Service;
datalines;
  9512028          112201    12/29/2010
  9512028          146435    12/29/2010
  9512028          112201    12/30/2010
  9512028          146435    12/30/2010
  9512028          146455    12/30/2010
  9512028          131301    12/30/2010
  9512028          112201    12/30/2010
  9512028          117155    12/30/2010
  9512028          115235    12/30/2010
  9512028          115325    12/30/2010
  9612028          115325    11/30/2010
  9612028          115325    11/30/2010
  9612028          146451    11/30/2010
  9612028          115325    11/30/2010
 17942028          146435    01/09/2011
 17942028          146455    01/10/2011
 17942028          112201    01/10/2011
 17942028          112201    01/10/2011
 17942028          146451    01/10/2011
 17942028          112131    01/10/2011
 17942028          146435    01/10/2011
 17942028          147421    01/10/2011
 17942028          181211    01/10/2011
 17942028          117155    01/10/2011
 17942028          115235    01/10/2011
 17942028          131141    01/10/2011
 17942028          115325    01/10/2011
 17942028          146451    01/10/2011
 17942028          119215    01/10/2011
 17942028          124143    01/11/2011
 17942028          146455    01/12/2011
 25132028          112201    01/17/2011
 25132028          146218    01/17/2011
 25132028          146435    01/17/2011
 25132028          146455    01/18/2011
 25132028          112131    01/18/2011
 25132028          112201    01/18/2011
 25132028          146435    01/18/2011
 25132028          147421    01/18/2011
 25132028          115130    01/18/2011
 25132028          115325    01/18/2011
; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the above sample data I want to retain the following observations since that patient only had drugs administered on one day but nothing before or after:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  9612028          115325    11/30/2010
  9612028          115325    11/30/2010
  9612028          146451    11/30/2010
  9612028          115325    11/30/2010&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I initially tried using _keepflag, but I don't think that's really what I want. Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&amp;nbsp;&lt;/P&gt;&lt;P&gt;A newer SAS user &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 17:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549356#M16863</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2019-04-08T17:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549381#M16864</link>
      <description>&lt;P&gt;SQL is absolutely a dream for problems like this. You can take a look at the intermediate datasets to see how the process works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;

	create table Inter01 as
		select Medical_Record_Number, date_of_Service, count(*) as DateCount
			from have
				group by Medical_Record_Number, date_of_Service;
	create table Inter02 as
		select Medical_Record_Number, count(*) as RecCount
			from Inter01
				group by Medical_Record_Number
					having RecCount = 1;
	create table Want as
		select h.* from Have h inner join Inter02 i
			on h.Medical_Record_Number = i.Medical_Record_Number;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Apr 2019 18:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549381#M16864</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-04-08T18:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549397#M16865</link>
      <description>&lt;P&gt;Thanks Tom! Super useful indeed, looks like I need to add SQL to my list of things to work on.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 19:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549397#M16865</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2019-04-08T19:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549419#M16866</link>
      <description>&lt;P&gt;I hope you enjoy your endeavours with SAS. I've been using it the 1970's, and I STILL haven't got to the end of the things I have to learn!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 20:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549419#M16866</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-04-08T20:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549536#M16870</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234707"&gt;@Shad&lt;/a&gt;&amp;nbsp;what if the two dates were&amp;nbsp;&lt;SPAN&gt;12/26/2010, and on 12/28/2010? Would you still drop them?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 09:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549536#M16870</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-09T09:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Longitudinal data management - keeping only records based off dates</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549721#M16872</link>
      <description>&lt;P&gt;For my purposes yes. I wanted to identify only individuals that received prescriptions on day 1 and at no other point.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 17:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Longitudinal-data-management-keeping-only-records-based-off/m-p/549721#M16872</guid>
      <dc:creator>Shad</dc:creator>
      <dc:date>2019-04-09T17:26:50Z</dc:date>
    </item>
  </channel>
</rss>

