Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do you identify ICD-10-CM codes in Nationwide Inpatient Sample (NIS) using STATA?

    NIS has 40 Diagnoses (dx1 to dx40) listed for every patient. I am trying to find how many have diabetes. There are a lot of ICD10CM codes for diabetes between E0800 to E1399.
    I have written this

    gen diabetes = 0
    foreach var of varlist dx1-dx40 {
    replace diabetes=1 if `var'=="E0800"
    replace diabetes=1 if `var'=="E0801"
    replace diabetes=1 if `var'=="E0802"
    replace diabetes=1 if `var'=="E0803"
    ....

    }

    but it will take an hour to write in all the diagnoses codes.. is there anything simpler?

  • #2
    Yes. You can write the codes as a range instead of typing each single code. See the help for the icd10 command.

    PS: pardon the pedantry, but we don’t spell Stata in all caps, unlike SAS or SPSS. I believe that both those names were once acronyms, but I don’t believe this was ever true of Stata.
    Last edited by Weiwen Ng; 23 May 2020, 04:19.
    Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

    When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Comment


    • #3
      Code:
      help icd10
      Best regards,

      Marcos

      Comment

      Working...
      X