<?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: SAS CODING FILTERING RANGE ICD 9 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478476#M123397</link>
    <description>&lt;P&gt;use "=:" for example "if &amp;amp;icdvar{i} =:'030' then neuro=1" [actually &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;already noted this] - i take this snippet from the sas macro at the following link which handles icd9 codes: &lt;A href="http://www.seattlechildrens.org/research/child-health-behavior-and-development/mangione-smith-lab/measurement-tools/" target="_blank"&gt;http://www.seattlechildrens.org/research/child-health-behavior-and-development/mangione-smith-lab/measurement-tools/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jul 2018 20:02:58 GMT</pubDate>
    <dc:creator>pau13rown</dc:creator>
    <dc:date>2018-07-16T20:02:58Z</dc:date>
    <item>
      <title>SAS CODING FILTERING RANGE ICD 9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478448#M123394</link>
      <description>&lt;P&gt;I need help with coding ICD9 codes. These codes have four or five digits. For example,&amp;nbsp;it can be E810 or E8100. I want to filter the range of these codes which can be E8100 to E8139 or E810 to E813. By using following code , I am missing out on five digit records starting with &lt;FONT color="#008000"&gt;E813, E819 , E825&lt;/FONT&gt;. I am also missing records with four digits such as E810, E812 ,E813 or 819. In short, I would like to filter observations starting with first four digits as well as &amp;nbsp;range starting those digits. Could anyone help with this? Thank you&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data WW.WW2;
set  WW.WW1;
If E_CODE_1 ='.........' Then ECODE_MECH ='........' ;
    IF 'E810%'&amp;lt;= E_CODE_1 &amp;lt;=&lt;FONT color="#008000"&gt;'E813%'&lt;/FONT&gt;  OR   'E815%'&amp;lt;= E_CODE_1&amp;lt;=&lt;FONT color="#008000"&gt;'E819%'&lt;/FONT&gt;  OR  'E822%'&amp;lt;= E_CODE_1&amp;lt;=&lt;FONT color="#008000"&gt;'E825%&lt;/FONT&gt;' OR E_CODE_1 IN ('E9885','E9290')
              THEN ECODE_MECH = '1';
    IF 'E814%'&amp;lt;= E_CODE_1 &amp;lt;= 'E814%'
              THEN ECODE_MECH= '2';
    RUN;
               &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 18:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478448#M123394</guid>
      <dc:creator>GARYV</dc:creator>
      <dc:date>2018-07-16T18:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CODING FILTERING RANGE ICD 9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478454#M123396</link>
      <description>&lt;P&gt;There are no wildcard filters like you have with %. That can work in SQL and/or using a WHERE clause.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use =: to check if the strings are equivalent and that may be what you want but be careful and test it thoroughly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The most efficient way I've found is to create a master list of the codes I do want - can usually filter from online lists and then use that directly with a PROC FORMAT to select the records of interest.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if E_CODE_1 =: 'E810' or E_CODE_1 =: 'E811' ... etc. 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or&amp;nbsp;you could convert a portion to a numeric and use that for your conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substr(e_code_1, 1,1) = 'E' and 810 &amp;lt;= input(substr(e_code_1, 2, 3), 8.)  &amp;lt;=813 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Be very careful with text comparisons using Greater Than or Less Than operators. The algorithm is text so it goes:&lt;/P&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;10&lt;/P&gt;
&lt;P&gt;11&lt;/P&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;P&gt;13&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;20&lt;/P&gt;
&lt;P&gt;21&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;20&lt;/P&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/186372"&gt;@GARYV&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need help with coding ICD9 codes. These codes have four or five digits. For example,&amp;nbsp;it can be E810 or E8100. I want to filter the range of these codes which can be E8100 to E8139 or E810 to E813. By using following code , I am missing out on five digit records starting with &lt;FONT color="#008000"&gt;E813, E819 , E825&lt;/FONT&gt;. I am also missing records with four digits such as E810, E812 ,E813 or 819. In short, I would like to filter observations starting with first four digits as well as &amp;nbsp;range starting those digits. Could anyone help with this? Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data WW.WW2;
set  WW.WW1;
If E_CODE_1 ='.........' Then ECODE_MECH ='........' ;
    IF 'E810%'&amp;lt;= E_CODE_1 &amp;lt;=&lt;FONT color="#008000"&gt;'E813%'&lt;/FONT&gt;  OR   'E815%'&amp;lt;= E_CODE_1&amp;lt;=&lt;FONT color="#008000"&gt;'E819%'&lt;/FONT&gt;  OR  'E822%'&amp;lt;= E_CODE_1&amp;lt;=&lt;FONT color="#008000"&gt;'E825%&lt;/FONT&gt;' OR E_CODE_1 IN ('E9885','E9290')
              THEN ECODE_MECH = '1';
    IF 'E814%'&amp;lt;= E_CODE_1 &amp;lt;= 'E814%'
              THEN ECODE_MECH= '2';
    RUN;
               &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 18:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478454#M123396</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-16T18:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CODING FILTERING RANGE ICD 9</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478476#M123397</link>
      <description>&lt;P&gt;use "=:" for example "if &amp;amp;icdvar{i} =:'030' then neuro=1" [actually &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;already noted this] - i take this snippet from the sas macro at the following link which handles icd9 codes: &lt;A href="http://www.seattlechildrens.org/research/child-health-behavior-and-development/mangione-smith-lab/measurement-tools/" target="_blank"&gt;http://www.seattlechildrens.org/research/child-health-behavior-and-development/mangione-smith-lab/measurement-tools/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 20:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CODING-FILTERING-RANGE-ICD-9/m-p/478476#M123397</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-07-16T20:02:58Z</dc:date>
    </item>
  </channel>
</rss>

