Announcement

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

  • ICD9 AND ICD10 Codes

    Hi All,

    I am currently working with a variable that contains ICD9 AND ICD10 codes. I want to generate a flag variable for all symptoms associated with a major disease.

    What would be the best way to create flags for this code. Everytime I use the ICD9 or ICD10 generate function, I get an error saying that certain things were "invalid ICD9 codes". Of course there are invalid ICD9 codes, because some of them are ICD10 codes. Is there any way to get around this, or just have it ignore the errors?

    Thanks,
    Zach

  • #2
    That sounds like a challenge. The easiest thing to do would be to go back to the data source and have them give you ICD-9 and -10 codes in separate variables. This seems like an oversight, or maybe really sloppy thinking.

    I am not as familiar with ICD-10 codes because the United States, where I live, has been very late in adopting ICD-10. I blame the American Medical Association, but I digress. If you can at least be sure that all the codes are diagnostic codes, then it looks like all ICD-10s begin with a letter.

    ICD-9 diagnosis codes are either all digits, or they begin with Vs or Es. The ICD-9 Vs are for supplemental classification of health status factors, and Es are for external causes of injury. The format of the ICD-10 codes beginning with Vs and Es looks like it is a V, 4 digits, then 2 letters. The ICD-9 codes are more like a V and then 2 to 3 letters.

    Thus, perhaps you could merge your codes with this file from the National Bureau of Economic Research. Codes that do merge with the file are ICD-9s. Codes that don't merge are ICD-10s. You'd probably want to inspect the _merge variable. If you have your own data in memory, then you merge 1:1 using the NBER file, codes that are not merged and are in the master file should be ICD-10s, codes that don't merge and are in the using file weren't present in your data.

    It may get more complicated if you have ICD-10 and -9 procedure codes. Do you have those?

    If the above don't work, it might be time to learn to write a regular expression, which can generate flags for things like "starts with V or E, has 4 digits, and ends in letters".

    A full listing of ICD-10 codes is here. It's a free site, but I've used it before. Here's their version for ICD-9 codes.
    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
      Another approach is to run -icd9 check, gen(error_code9)-. Then save the observations that have error_code9 == 0 into a separate data file--these observations all have valid ICD9 codes. Now drop those observations from the original data and run -icd10 check, gen(error_code10). Again, save the observations with error_code10 == 0 into another file--these observations all have valid ICD10 codes. Now drop those observations from the data. Any observations remaining have something that is neither a legitimate ICD9 code nor a legitimate ICD10 code. The values of the error codes plus visual inspection should give you a good idea what the source of the problem is in most cases. Some may just be mysteries! Anyway, you can clean those up as best you can. Then you can put the cleaned ones and the valid ICD9 and ICD10 data sets together again. It will probably be a good idea to rename the code variable explicitly to ICD9 in the first case, and to ICD10 in the second case before you re-combine the data sets so that additional work with -icd9- or -icd10- subcommands will go smoothly.

      Comment

      Working...
      X