<?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 How to remove duplicate encounter types from clinical dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-duplicate-encounter-types-from-clinical-dataset/m-p/830039#M327963</link>
    <description>&lt;P&gt;&lt;FONT color="#000000"&gt;hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have little SAS experience and has been a challenge doing some data cleaning on my dataset.&amp;nbsp;&lt;SPAN&gt;I have a dataset with 6 years worth of patient healthcare claims (2017-2022). Patients appear multiple times within each year and also reappear in subsequent years. What I want to do is eliminate the duplicates within the year. I&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;was hoping to receive some pointers from this community. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;My dataset contains&amp;nbsp; "admit_date" for when they were admitted to receive medical care and&amp;nbsp; "encounter" (character variable) for the type of level of medical urgency (emergency, outpatient or inpatient). however, say patient 01 was admitted 2 or more times within a week/month as an (outpatient encounter).&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;I would like to remove duplicates based on urgency level first&lt;/STRONG&gt; so that I can then be able to narrow down to at least one "encounter" for every 30 day intervals. Below is a code I tried with the help of a colleague but keep getting an error, mind you this is using SQL but if I can get it done without using SQL that would be great.&amp;nbsp;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;currently using SAS 9.4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc sql;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;create table&lt;/FONT&gt; SSTIs_w_o_Dupadmitdate &lt;FONT color="#0000FF"&gt;as&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;select DISTINCT&lt;/FONT&gt; (admit_date)&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;from&lt;/FONT&gt; research.Sstis&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;order by&lt;/FONT&gt; mrn &lt;FONT color="#0000FF"&gt;where&lt;/FONT&gt; Encounter &lt;FONT color="#0000FF"&gt;not&lt;/FONT&gt;=&lt;FONT color="#993300"&gt; "Outpatient"&lt;/FONT&gt;;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;I get the error below&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;37 proc sql;&lt;BR /&gt;38 create table SSTIs_w_o_Dupadmitdate as&lt;BR /&gt;39 select DISTINCT (admit_date)&lt;BR /&gt;40 from research.Sstis&lt;BR /&gt;41 order by mrn where Encounter not= "Outpatient";&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-----&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;202&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, (, *, **, +, ',', -, '.',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;/, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, ASC, ASCENDING, BETWEEN, CONTAINS, DESC, DESCENDING,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;^, ^=, |, ||, ~, ~=.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2022 08:29:18 GMT</pubDate>
    <dc:creator>pru6</dc:creator>
    <dc:date>2022-08-24T08:29:18Z</dc:date>
    <item>
      <title>How to remove duplicate encounter types from clinical dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-duplicate-encounter-types-from-clinical-dataset/m-p/830039#M327963</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have little SAS experience and has been a challenge doing some data cleaning on my dataset.&amp;nbsp;&lt;SPAN&gt;I have a dataset with 6 years worth of patient healthcare claims (2017-2022). Patients appear multiple times within each year and also reappear in subsequent years. What I want to do is eliminate the duplicates within the year. I&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;was hoping to receive some pointers from this community. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;My dataset contains&amp;nbsp; "admit_date" for when they were admitted to receive medical care and&amp;nbsp; "encounter" (character variable) for the type of level of medical urgency (emergency, outpatient or inpatient). however, say patient 01 was admitted 2 or more times within a week/month as an (outpatient encounter).&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;I would like to remove duplicates based on urgency level first&lt;/STRONG&gt; so that I can then be able to narrow down to at least one "encounter" for every 30 day intervals. Below is a code I tried with the help of a colleague but keep getting an error, mind you this is using SQL but if I can get it done without using SQL that would be great.&amp;nbsp;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;currently using SAS 9.4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc sql;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;create table&lt;/FONT&gt; SSTIs_w_o_Dupadmitdate &lt;FONT color="#0000FF"&gt;as&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;select DISTINCT&lt;/FONT&gt; (admit_date)&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;from&lt;/FONT&gt; research.Sstis&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;order by&lt;/FONT&gt; mrn &lt;FONT color="#0000FF"&gt;where&lt;/FONT&gt; Encounter &lt;FONT color="#0000FF"&gt;not&lt;/FONT&gt;=&lt;FONT color="#993300"&gt; "Outpatient"&lt;/FONT&gt;;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;I get the error below&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;37 proc sql;&lt;BR /&gt;38 create table SSTIs_w_o_Dupadmitdate as&lt;BR /&gt;39 select DISTINCT (admit_date)&lt;BR /&gt;40 from research.Sstis&lt;BR /&gt;41 order by mrn where Encounter not= "Outpatient";&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-----&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;202&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &amp;amp;, (, *, **, +, ',', -, '.',&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;/, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, ASC, ASCENDING, BETWEEN, CONTAINS, DESC, DESCENDING,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;^, ^=, |, ||, ~, ~=.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 08:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-duplicate-encounter-types-from-clinical-dataset/m-p/830039#M327963</guid>
      <dc:creator>pru6</dc:creator>
      <dc:date>2022-08-24T08:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove duplicate encounter types from clinical dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-duplicate-encounter-types-from-clinical-dataset/m-p/830054#M327972</link>
      <description>&lt;P&gt;"order by" must be placed after "where", valid symbols for "not equals" are ne, ^= and some more i can't remember right now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 10:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-duplicate-encounter-types-from-clinical-dataset/m-p/830054#M327972</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-08-24T10:51:12Z</dc:date>
    </item>
  </channel>
</rss>

