<?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: Diagnosis codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704570#M216001</link>
    <description>&lt;P&gt;Use the colon operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if diag{i} in: ("E10", "E11", "E13") then diag_control=1;
else diag_control=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356491"&gt;@RebeccaB_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to flag all individuals with diagnosis codes E10, E11, and E13. The problem is, I would like this to include all values for that overarching diagnosis code. So for example, if there are diagnosis codes E11.17, E11.21, E11.34, E10.22, E13.49, I would like to flag any with E10, E11, or E13 to be flagged. My code is below and thanks in advance for any help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data work.diabetes_control_num;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set work.diabetes_control;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array a1c_last{1} a1c2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i= 1 to 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i=1 to 3; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if diag{i} = in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2020 22:25:25 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-12-08T22:25:25Z</dc:date>
    <item>
      <title>Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704554#M215996</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to flag all individuals with diagnosis codes E10, E11, and E13. The problem is, I would like this to include all values for that overarching diagnosis code. So for example, if there are diagnosis codes E11.17, E11.21, E11.34, E10.22, E13.49, I would like to flag any with E10, E11, or E13 to be flagged. My code is below and thanks in advance for any help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data work.diabetes_control_num;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set work.diabetes_control;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array a1c_last{1} a1c2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i= 1 to 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i=1 to 3; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if diag{i} = in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 21:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704554#M215996</guid>
      <dc:creator>RebeccaB_</dc:creator>
      <dc:date>2020-12-08T21:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704560#M215998</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356491"&gt;@RebeccaB_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to flag all individuals with diagnosis codes E10, E11, and E13. The problem is, I would like this to include all values for that overarching diagnosis code. So for example, if there are diagnosis codes E11.17, E11.21, E11.34, E10.22, E13.49, I would like to flag any with E10, E11, or E13 to be flagged. My code is below and thanks in advance for any help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data work.diabetes_control_num;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set work.diabetes_control;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array a1c_last{1} a1c2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i= 1 to 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i=1 to 3; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if diag{i} = in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually almost there. If the values are as you say you could use SCAN or SUBSTR functions to get the first letters from your diag codevalues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if&amp;nbsp; Scan( diag{i},1,'.') in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/P&gt;
&lt;P&gt;or &lt;/P&gt;
&lt;P&gt;if substr(diag{i},1,3) in ("E10", "E11","E13") then ...&lt;/P&gt;
&lt;P&gt;Alternate&lt;/P&gt;
&lt;P&gt;Diag_control = (&amp;nbsp;Scan( diag{i},1,'.') in ("E10", "E11", "E13") );&lt;/P&gt;
&lt;P&gt;(Exercise for the interested reader for the similar SUBSTR version).&lt;/P&gt;
&lt;P&gt;This assignment works because will assign a 1 for true and 0 for false for any logic comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't want to use "= in (&amp;lt;value list&amp;gt;)" just the "in (&amp;lt;value list&amp;gt;)"&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 21:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704560#M215998</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-08T21:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704570#M216001</link>
      <description>&lt;P&gt;Use the colon operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if diag{i} in: ("E10", "E11", "E13") then diag_control=1;
else diag_control=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356491"&gt;@RebeccaB_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to flag all individuals with diagnosis codes E10, E11, and E13. The problem is, I would like this to include all values for that overarching diagnosis code. So for example, if there are diagnosis codes E11.17, E11.21, E11.34, E10.22, E13.49, I would like to flag any with E10, E11, or E13 to be flagged. My code is below and thanks in advance for any help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data work.diabetes_control_num;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set work.diabetes_control;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array a1c_last{1} a1c2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i= 1 to 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i=1 to 3; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if diag{i} = in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 22:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704570#M216001</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-12-08T22:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704579#M216003</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Use the colon operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if diag{i} in: ("E10", "E11", "E13") then diag_control=1;
else diag_control=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/356491"&gt;@RebeccaB_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to flag all individuals with diagnosis codes E10, E11, and E13. The problem is, I would like this to include all values for that overarching diagnosis code. So for example, if there are diagnosis codes E11.17, E11.21, E11.34, E10.22, E13.49, I would like to flag any with E10, E11, or E13 to be flagged. My code is below and thanks in advance for any help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data work.diabetes_control_num;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set work.diabetes_control;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array a1c_last{1} a1c2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i= 1 to 1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i=1 to 3; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if diag{i} = in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Might be an issue if codes of E100, E110 or E130 exist. May not be an issue but there are just so blinking many ICD codes out there ...&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 22:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704579#M216003</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-08T22:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704586#M216006</link>
      <description>True, but you could also just add the periods to the end in that case but it really depends on the coding. In a perfect world you have a lookup table that has the code in a hierarchical fashion you can just filter out.</description>
      <pubDate>Tue, 08 Dec 2020 22:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704586#M216006</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-12-08T22:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704766#M216080</link>
      <description>&lt;P&gt;Thank you for the help! I've used both scan and substr but all observations of diag_control are still being flagged as "0", but I can visually see an observation that, for example, has diagnosis_1 = E11.21. Any suggestions in changing my code so that I can capture this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;CODE:&lt;/STRONG&gt;&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data work.diabetes_control_num;&lt;BR /&gt;set work.diabetes_control;&lt;BR /&gt;array diag{3} $ diagnosis_1 diagnosis_2 diangosis_3;&lt;BR /&gt;array a1c_last{1} a1c2;&lt;BR /&gt;do i= 1 to 1;&lt;BR /&gt;if a1c_last{i} &amp;gt;= 9 then dm_control=0; else if a1c_last{i}=. then dm_control=.; else dm_control=1;&lt;BR /&gt;end;&lt;BR /&gt;do i=1 to 3;&lt;BR /&gt;if Scan( diag{i},1,'.') in ("E10", "E11", "E13") then diag_control=1; else diag_control=0;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704766#M216080</guid>
      <dc:creator>RebeccaB_</dc:creator>
      <dc:date>2020-12-09T15:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Diagnosis codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704792#M216086</link>
      <description>Drop the else, otherwise it will always get reset to 0.</description>
      <pubDate>Wed, 09 Dec 2020 16:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Diagnosis-codes/m-p/704792#M216086</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-12-09T16:41:10Z</dc:date>
    </item>
  </channel>
</rss>

