<?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: Specifying a set of ICD codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463002#M117897</link>
    <description>&lt;P&gt;The first thing we need is an example of your dataset. See my footnotes for how to convert a dataset to data step code and how to post that code.&lt;/P&gt;</description>
    <pubDate>Thu, 17 May 2018 13:55:22 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-05-17T13:55:22Z</dc:date>
    <item>
      <title>Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463000#M117896</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to filter a data using a set of ICD codes. In my sas dataset, there are 18 diagnosis-related variables (1 primary and 17 secondary; character and $7) and I have a set of ICD codes/conditions I am interested in. I want to tell SAS to examine all 18 variables and pick out the observations that match one of the ICD codes. Here's the ICD codes I am interested in:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;O36.4XX0-036.4XX9&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z37.1 Z37.3 Z37.4&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z37.6&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.60&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.61&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.62&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.63&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.64&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Z37.69&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z37.7&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I can use CATX but not sure how to go about it. Any comments would be greatly appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 13:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463000#M117896</guid>
      <dc:creator>Kiko</dc:creator>
      <dc:date>2018-05-17T13:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463002#M117897</link>
      <description>&lt;P&gt;The first thing we need is an example of your dataset. See my footnotes for how to convert a dataset to data step code and how to post that code.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 13:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463002#M117897</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-17T13:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463005#M117898</link>
      <description>&lt;P&gt;Thank you for your reply. Unfortunately I don't have access to the data at the moment. What I posted is a summary of the instruction I got and I was trying to figure out a way to do it before I receive the data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 13:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463005#M117898</guid>
      <dc:creator>Kiko</dc:creator>
      <dc:date>2018-05-17T13:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463006#M117899</link>
      <description>&lt;P&gt;You can use catx() to concatenate all the character variables and then use index() to see if a comparison string is present in there.&lt;/P&gt;
&lt;P&gt;If you need to check for several strings, you can either use a macro %do loop to repetitively create code, or store your comparison strings into a temporary array you can use in a (datastep code) do loop.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463006#M117899</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-17T14:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463007#M117900</link>
      <description>&lt;P&gt;1) You wrote:&amp;nbsp;&lt;STRONG&gt;"&lt;SPAN&gt;there are 18 diagnosis-related variables&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp;..." - please post your dataset format, to show which variables are there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; and what do you mean by primary and secondary icodes. It is enougth to display the releant variables.&lt;/P&gt;
&lt;P&gt;2) Is the set you are looking for fix or do you preffer to have it dymaic, easy to change ?&lt;/P&gt;
&lt;P&gt;3) You mentiond that ICOD is a CHAR type $7 - then what do you mean by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;O36.4XX0-036.4XX9   /* is this a rage of ICODES   */

Z37.1 Z37.3 Z37.4   /* is this a list of ICODES ? */&lt;BR /&gt;&lt;BR /&gt;Is the ICODE aligned to left or it can contain leading spaces ?&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 May 2018 14:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463007#M117900</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-05-17T14:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463009#M117901</link>
      <description>&lt;P&gt;The way that I've seen this done before:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use a SAS array to hold the values of each diagnosis code variable in your record&lt;/LI&gt;
&lt;LI&gt;Then use the IN operator&amp;nbsp;to check for each of your potential DX codes.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://support.sas.com/resources/papers/proceedings16/5720-2016.pdf" target="_self"&gt;this paper for some examples&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excerpt:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ExampleA2;
 set TableA;
 array AllDiagCodes {25} $ DgCd1 – DgCd25;
 RespInd = 0;
 do i = 1 to 25;
   if AllDiagCodes{i} IN ('A100','A304','A503')
    then RespInd = 1;
 end;
 drop i;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A faster, and probably more robust method will involve the hash object.&amp;nbsp; But hash objects have a bit of a learning curve.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463009#M117901</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-05-17T14:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463010#M117902</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/135005"&gt;@Kiko&lt;/a&gt;&amp;nbsp;I concur with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;on hash solution. If you could provide us a clear HAVE sample and a WANT sample, I would like to attempt the hash solution and that helps not going back and forth for further clarity. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463010#M117902</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-17T14:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463012#M117903</link>
      <description>&lt;P&gt;I clearly confused a lot of people... Hope this clarifies a few things&lt;BR /&gt;&lt;BR /&gt;1) I haven't received the data yet I just know there are 18 diagnosis-related variables I can use and the format(size) of these variables are txt (7)&lt;BR /&gt;2) Fixed&lt;BR /&gt;3) Yes, those are the ICD codes we are interested in.&lt;BR /&gt;&lt;BR /&gt;As far as I know they do not have leading spaces and they are aligned to left.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463012#M117903</guid>
      <dc:creator>Kiko</dc:creator>
      <dc:date>2018-05-17T14:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463013#M117904</link>
      <description>&lt;P&gt;If you are looking to actually learn something, rather than accepting a solution you barely understand, here's what I would suggest.&amp;nbsp; (Other solutions are perfectly fine, but you have to appreciate that the background of the posters varies quite a bit and what might work best is not necessarily the best choice for&amp;nbsp;you.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1) On your own, write a program that would check just one diagnosis code against your list of possible values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) To check all the diagnosis codes instead of just one, apply the arrays suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3) Make one small change to it, to speed things up slightly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;do i &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; to &lt;SPAN class="token number"&gt;25 until (RespInd=1);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token number"&gt;That way, the program will stop checking the rest of the ICD codes as soon as it finds a match.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463013#M117904</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-17T14:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying a set of ICD codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463297#M118018</link>
      <description>Great suggestion. Thank you for your thoughtful response.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 May 2018 12:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Specifying-a-set-of-ICD-codes/m-p/463297#M118018</guid>
      <dc:creator>Kiko</dc:creator>
      <dc:date>2018-05-18T12:42:46Z</dc:date>
    </item>
  </channel>
</rss>

