<?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 select subject who had ≥2 claims on separate dates for an asthma diagnosis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679757#M205289</link>
    <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset below and I would like to&amp;nbsp;select subject who had ≥2 claims on separate dates for an asthma diagnosis, and for the final dataset, keep the earliest data as the indexdate. I had run my codes below, and it seems my codes were redundant. I was wondering if someone could help me to improve my codes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input id $ indexdate : mmddyy10. asthma $;&lt;BR /&gt;format indexdate mmddyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;201 04/10/2013 1&lt;BR /&gt;201 04/11/2013 1&lt;BR /&gt;201 04/12/2013 1&lt;BR /&gt;202 02/21/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/08/2013 1&lt;BR /&gt;202 03/09/2013 1&lt;BR /&gt;202 03/20/2013 1&lt;BR /&gt;203 02/14/2013 1&lt;BR /&gt;203 02/15/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;205 03/18/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=have out=have_nodup nodupkey;&lt;BR /&gt;by id indexdate;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=have_nodup nouniquekeys out=have_a;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=have_a nodupkey out=want;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2020 15:20:02 GMT</pubDate>
    <dc:creator>lulu3</dc:creator>
    <dc:date>2020-08-27T15:20:02Z</dc:date>
    <item>
      <title>select subject who had ≥2 claims on separate dates for an asthma diagnosis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679757#M205289</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset below and I would like to&amp;nbsp;select subject who had ≥2 claims on separate dates for an asthma diagnosis, and for the final dataset, keep the earliest data as the indexdate. I had run my codes below, and it seems my codes were redundant. I was wondering if someone could help me to improve my codes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input id $ indexdate : mmddyy10. asthma $;&lt;BR /&gt;format indexdate mmddyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;201 04/10/2013 1&lt;BR /&gt;201 04/11/2013 1&lt;BR /&gt;201 04/12/2013 1&lt;BR /&gt;202 02/21/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/08/2013 1&lt;BR /&gt;202 03/09/2013 1&lt;BR /&gt;202 03/20/2013 1&lt;BR /&gt;203 02/14/2013 1&lt;BR /&gt;203 02/15/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;205 03/18/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=have out=have_nodup nodupkey;&lt;BR /&gt;by id indexdate;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=have_nodup nouniquekeys out=have_a;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=have_a nodupkey out=want;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679757#M205289</guid>
      <dc:creator>lulu3</dc:creator>
      <dc:date>2020-08-27T15:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: select subject who had ≥2 claims on separate dates for an asthma diagnosis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679770#M205296</link>
      <description>&lt;P&gt;Is that what you are looking for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=temp nodupkey;
  by id indexdate;
run;
data want;
 set temp;
   by id indexdate;
      if not (first.indexdate and last.indexdate); /* more then 1 claim */
      if first.indexdate; /* the earliest claim */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It would be easy to check if you post the wanted results.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:35:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679770#M205296</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-27T15:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: select subject who had ≥2 claims on separate dates for an asthma diagnosis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679776#M205300</link>
      <description>&lt;P&gt;SQL is slightly better at this type of analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select ID, count(distinct indexdate) as num_dates
from have 
where asthma=1
group by id
having num_dates &amp;gt;=2;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/334943"&gt;@lulu3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset below and I would like to&amp;nbsp;select subject who had ≥2 claims on separate dates for an asthma diagnosis, and for the final dataset, keep the earliest data as the indexdate. I had run my codes below, and it seems my codes were redundant. I was wondering if someone could help me to improve my codes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input id $ indexdate : mmddyy10. asthma $;&lt;BR /&gt;format indexdate mmddyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;201 04/10/2013 1&lt;BR /&gt;201 04/11/2013 1&lt;BR /&gt;201 04/12/2013 1&lt;BR /&gt;202 02/21/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/07/2013 1&lt;BR /&gt;202 03/08/2013 1&lt;BR /&gt;202 03/09/2013 1&lt;BR /&gt;202 03/20/2013 1&lt;BR /&gt;203 02/14/2013 1&lt;BR /&gt;203 02/15/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;204 01/23/2013 1&lt;BR /&gt;205 03/18/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;206 05/01/2013 1&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have out=have_nodup nodupkey;&lt;BR /&gt;by id indexdate;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=have_nodup nouniquekeys out=have_a;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=have_a nodupkey out=want;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-subject-who-had-2-claims-on-separate-dates-for-an-asthma/m-p/679776#M205300</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-27T15:39:57Z</dc:date>
    </item>
  </channel>
</rss>

