<?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: how to find dx codes in SID HCUP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964556#M375634</link>
    <description>&lt;P&gt;It would be &lt;STRONG&gt;very good idea&lt;/STRONG&gt; that when posting code related to problems to post a log of the complete step in question. That means for a data step question start at Data and stop with the notes, warnings and or error messages at the end. For a procedure start at the Proc statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means we don't have to ask questions like "Is the syntax of the DROP statement you show actually what you submiited?"&lt;/P&gt;
&lt;PRE&gt;data NY2016_deliveries;
set NY2016; 
length delivery_flag dxpos 3 dx $10;
delivery_flag = 0;
dxpos=.;
dx=' ';
array dx_vars {*} DX1-DX25;
do i = 1 to dim(dx_vars);
    if substr(dx_vars[i], 1, 3) in ('O60', 'O61') then do;
        delivery_flag=1;
        dxpos=i;
        dx=dx_vars[i];
        output;
        leave;
    end;  
end;
drop i dx1-dx-25;
run;&lt;/PRE&gt;
&lt;P&gt;Your code as shown does not execute at all it would throw&lt;/P&gt;
&lt;PRE&gt;17   drop i dx1-dx-25;
                  -
                  22
                  76
ERROR 22-322: Syntax error, expecting one of the following: a name, ;,
              _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 76-322: Syntax error, statement will be ignored.
&lt;/PRE&gt;
&lt;P&gt;Including all the notes and messages would also provide answers to the problems that will arise if any of the DX1 through DX25 variables are numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Apr 2025 22:26:13 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2025-04-17T22:26:13Z</dc:date>
    <item>
      <title>how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964447#M375600</link>
      <description>&lt;P&gt;Hi I'm new to coding HCUP data in SAS. I am using ICD10 codes but it seems, but it seems like SAS is not accepting the characters. For instance the variable name is |10_DX1 but I get an error message any time that I use it. I am looking for ICD 10 codes specific to deliveries. The code below doesn't seem to work. How to I find ICD10 codes specific to deliveries? I am using SAS v9.4 on JupyterLab.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data = NY2016_deliveries;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; set NY2016;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; delivery_flag = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array dx_vars {*} DX1-DX25;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;do i = 1 to dim (dx_vars);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if substr(dx_vars[i], 1, 3) in;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;('O60', 'O61',)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delivery_flag=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; leave;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; end;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 16:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964447#M375600</guid>
      <dc:creator>charleenjm</dc:creator>
      <dc:date>2025-04-16T16:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964455#M375601</link>
      <description>&lt;P&gt;&lt;STRONG&gt;ALWAYS&lt;/STRONG&gt; post the log when you have issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This looks wrong:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data = NY2016_deliveries;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A DATA statement does not have an equal sign apart from those needed in additional options.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 19:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964455#M375601</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-04-16T19:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964463#M375602</link>
      <description>&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data NY2016_deliveries;
set NY2016; 
length delivery_flag dxpos 3 dx $10;
delivery_flag = 0;
dxpos=.;
dx=' ';
array dx_vars {*} DX1-DX25;
do i = 1 to dim(dx_vars);
    if substr(dx_vars[i], 1, 3) in ('O60', 'O61') then do;
        delivery_flag=1;
        dxpos=i;
        dx=dx_vars[i];
        output;
        leave;
    end;  
end;
drop i dx1-dx-25;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Apr 2025 01:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964463#M375602</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-04-17T01:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964464#M375603</link>
      <description>This keeps only rows that have a delivery dx.  If you want to keep all rows regardless of whether they have a dx of interest, remove the 'output' statement.</description>
      <pubDate>Thu, 17 Apr 2025 01:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964464#M375603</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-04-17T01:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964556#M375634</link>
      <description>&lt;P&gt;It would be &lt;STRONG&gt;very good idea&lt;/STRONG&gt; that when posting code related to problems to post a log of the complete step in question. That means for a data step question start at Data and stop with the notes, warnings and or error messages at the end. For a procedure start at the Proc statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means we don't have to ask questions like "Is the syntax of the DROP statement you show actually what you submiited?"&lt;/P&gt;
&lt;PRE&gt;data NY2016_deliveries;
set NY2016; 
length delivery_flag dxpos 3 dx $10;
delivery_flag = 0;
dxpos=.;
dx=' ';
array dx_vars {*} DX1-DX25;
do i = 1 to dim(dx_vars);
    if substr(dx_vars[i], 1, 3) in ('O60', 'O61') then do;
        delivery_flag=1;
        dxpos=i;
        dx=dx_vars[i];
        output;
        leave;
    end;  
end;
drop i dx1-dx-25;
run;&lt;/PRE&gt;
&lt;P&gt;Your code as shown does not execute at all it would throw&lt;/P&gt;
&lt;PRE&gt;17   drop i dx1-dx-25;
                  -
                  22
                  76
ERROR 22-322: Syntax error, expecting one of the following: a name, ;,
              _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 76-322: Syntax error, statement will be ignored.
&lt;/PRE&gt;
&lt;P&gt;Including all the notes and messages would also provide answers to the problems that will arise if any of the DX1 through DX25 variables are numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 22:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964556#M375634</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-04-17T22:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964557#M375635</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;- yup, that one was my mistake (in the DROP statement) - obv. should be:&amp;nbsp; ...-dx25&amp;nbsp; &amp;nbsp;rather than:&amp;nbsp; ...-dx-25.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 22:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964557#M375635</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-04-17T22:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964745#M375692</link>
      <description>&lt;P&gt;I tried a different approach. The variable name for ICD 10 codes is |10_DX1-|10_DX25. However SAS doesn't accept the | character so I am not sure how to proceed but I tried another way here's the log with error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data scdny2016_delivery;&lt;BR /&gt;set scdny2016;&lt;/P&gt;&lt;P&gt;delivery_flag = 0;&lt;/P&gt;&lt;P&gt;array dx_vars {*}&lt;BR /&gt;I10_DX1 I10_DX2 I10_DX3 I10_DX4 I10_DX5&lt;BR /&gt;I10_DX6 I10_DX7 I10_DX8 I10_DX9 I10_DX10&lt;BR /&gt;I10_DX11 I10_DX12 I10_DX13 I10_DX14 I10_DX15&lt;BR /&gt;I10_DX16 I10_DX17 I10_DX18 I10_DX19 I10_DX20&lt;BR /&gt;I10_DX21 I10_DX22 I10_DX23 I10_DX24 I10_DX25;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(dx_vars);&lt;BR /&gt;if substr(dx_vars[i], 1, 3) in&lt;BR /&gt;('O60', 'O61', 'O62', 'O63', 'O64', 'O65', 'O66', 'O67', 'O68', 'O69',&lt;BR /&gt;'O70', 'O71', 'O72', 'O73', 'O74', 'O75', 'O76', 'O77', 'O78', 'O79',&lt;BR /&gt;'O80', 'O81', 'O82', 'Z37', 'Z38') then do;&lt;/P&gt;&lt;P&gt;delivery_flag = 1;&lt;BR /&gt;leave;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 14:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964745#M375692</guid>
      <dc:creator>charleenjm</dc:creator>
      <dc:date>2025-04-21T14:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964746#M375693</link>
      <description>&lt;P&gt;It's very unlikely that you have variables names with a in them, like:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;I10_DX1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;If you run PROC CONTENTS on your data and look at the list of variables, you see | characters there in the variable name?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 14:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964746#M375693</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-04-21T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964750#M375694</link>
      <description>&lt;P&gt;Why do you think the variable name is |10_DX1 ?&amp;nbsp; I really doubt that HCUP would name a variable that way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do have non-standard variable names you need to use name literals when referencing them in your SAS code.&lt;/P&gt;
&lt;PRE&gt;'|10_DX1'n&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Apr 2025 14:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964750#M375694</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-21T14:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964751#M375695</link>
      <description>&lt;P&gt;This seemed to work:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data SCDNY2016_deliveries;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set scdny2016;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;length delivery_flag dxpos 3 dx $10;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;delivery_flag = 0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;dxpos=.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array dx_vars {*} I10_DX1-I10_DX25;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;do i = 1 to dim(dx_vars);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if substr(dx_vars[i], 1, 3) in ('O60', 'O61') then do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;delivery_flag=1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;dxpos = i;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;dx = dx_vars[i];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; leave;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;drop i;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc print data=SCDNY2016_deliveries (obs=10); /*checking the first 10 observations*/&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 14:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964751#M375695</guid>
      <dc:creator>charleenjm</dc:creator>
      <dc:date>2025-04-21T14:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to find dx codes in SID HCUP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964753#M375696</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="charleenjm_0-1745246512438.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/106390i8FFA567F10C95EFE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="charleenjm_0-1745246512438.png" alt="charleenjm_0-1745246512438.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Yea, I thought it was weird too but changed the character from | to I (uppercase i) and it seems to have worked&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 14:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-dx-codes-in-SID-HCUP/m-p/964753#M375696</guid>
      <dc:creator>charleenjm</dc:creator>
      <dc:date>2025-04-21T14:42:40Z</dc:date>
    </item>
  </channel>
</rss>

