<?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 At least two outpatient claims in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935529#M367825</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for this community so far. It is of being great help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my project, comorbidities are identified using ICD-10 diagnosis codes where there is ≥ 1 inpatient or ≥ 2 outpatient claims (on different dates) during the 12-month baseline period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have trouble coding for at least two outpatient claims from medical file. I used the following code but the sample size decreased drastically so I am not sure if I am doing it right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input patid $ comorb_date YYMMDD10 diag$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; 2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2021/04/04 TRE&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp;2018/08/09 TYR&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; 2018/08/09&amp;nbsp; &amp;nbsp;QWK&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Data want will look like this -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; 2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2021/04/04 TRE&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp;2018/08/09 TYR&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; 2018/08/09&amp;nbsp; &amp;nbsp;QWK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patid 1 had same diag codes on 2019/01/23 so one row was removed. Patid 2 has different diagnosis codes on the same date so it will be retained.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried code -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sql;&lt;BR /&gt;create table OP_twodiagnosis as&lt;BR /&gt;select patid, count (distinct comorb_date) as cnt_op_dx&lt;BR /&gt;from test&lt;BR /&gt;group by patid, diag&lt;BR /&gt;;&lt;BR /&gt;quit;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Data created.OP_twodiagnosis_2;&lt;BR /&gt;set created.OP_twodiagnosis;&lt;BR /&gt;if cnt_op_dx &amp;gt;= 2;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shweta&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2024 00:17:11 GMT</pubDate>
    <dc:creator>SSK_011523</dc:creator>
    <dc:date>2024-07-12T00:17:11Z</dc:date>
    <item>
      <title>At least two outpatient claims</title>
      <link>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935529#M367825</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for this community so far. It is of being great help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my project, comorbidities are identified using ICD-10 diagnosis codes where there is ≥ 1 inpatient or ≥ 2 outpatient claims (on different dates) during the 12-month baseline period.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have trouble coding for at least two outpatient claims from medical file. I used the following code but the sample size decreased drastically so I am not sure if I am doing it right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input patid $ comorb_date YYMMDD10 diag$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; 2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2021/04/04 TRE&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp;2018/08/09 TYR&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; 2018/08/09&amp;nbsp; &amp;nbsp;QWK&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Data want will look like this -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; 2019/01/23 AZER&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp;2021/04/04 TRE&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp;2018/08/09 TYR&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; 2018/08/09&amp;nbsp; &amp;nbsp;QWK&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patid 1 had same diag codes on 2019/01/23 so one row was removed. Patid 2 has different diagnosis codes on the same date so it will be retained.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried code -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sql;&lt;BR /&gt;create table OP_twodiagnosis as&lt;BR /&gt;select patid, count (distinct comorb_date) as cnt_op_dx&lt;BR /&gt;from test&lt;BR /&gt;group by patid, diag&lt;BR /&gt;;&lt;BR /&gt;quit;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Data created.OP_twodiagnosis_2;&lt;BR /&gt;set created.OP_twodiagnosis;&lt;BR /&gt;if cnt_op_dx &amp;gt;= 2;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shweta&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 00:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935529#M367825</guid>
      <dc:creator>SSK_011523</dc:creator>
      <dc:date>2024-07-12T00:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: At least two outpatient claims</title>
      <link>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935538#M367828</link>
      <description>&lt;P&gt;First please test example data step code. Your code doesn't use YYMMDD10 as the&amp;nbsp; informat as it is missing the period at the end. Also Cards or datalines end with a ; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is a good idea on this forum to paste data step (and other code as well) into a text box opened on the forum with the &amp;lt;/&amp;gt; icon to prevent the forum software from reformatting text pasted into the main message windows. With data step that reformatting can change column positions enough that some input statements throw errors or read values incorrectly or sometimes acquire not visible characters that will cause other problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't provide much example data and completely skipped over how to tell the difference between an inpatient and outpatient observation. This might provide some help as a starting point for next steps using that information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL is pretty weak about anything regarding order of processing and you have an explicit order requirement (not two or more same diad on a date per patient) and possibly implied in the inpatiend/outpatient bit since different counts are used for a rule.&lt;/P&gt;
&lt;PRE&gt;proc sort data=test out=testless nodupkey;
   by patid comorb_date diag;
run;

/* add a diag counter*/
data helpful;
   set testless;
   by patid comorb_date;
   retain counter;
   if first.patid then counter=1;
   else counter+1;
run;&lt;/PRE&gt;
&lt;P&gt;I added a counter variable so you can see the way things increment.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 02:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935538#M367828</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-12T02:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: At least two outpatient claims</title>
      <link>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935683#M367864</link>
      <description>&lt;P&gt;Questions:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If a patient has one inpatient claim and one outpatient claim, do you keep both records for that patient?&amp;nbsp; Or just the qualifying record?&lt;/LI&gt;
&lt;LI&gt;How do you identify inpatient vs outpatient claims?&lt;/LI&gt;
&lt;LI&gt;Do any of your patients have data spanning more than twelve months?
&lt;OL&gt;
&lt;LI&gt;If a patient has two years of data, and two qualifying records in the first twelve months, do you keep the entire history?&lt;/LI&gt;
&lt;LI&gt;Or maybe only records within twelve months of the nearest qualifying records?&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;Are your data sorted, as in your example?&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sat, 13 Jul 2024 01:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/At-least-two-outpatient-claims/m-p/935683#M367864</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-07-13T01:30:47Z</dc:date>
    </item>
  </channel>
</rss>

