Announcement

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

  • NIS help

    Posting this again in case it was buried:

    HI Everyone, I am working on NIS and trying to extract DX codes to create variables....this example is the code for non-severe pre-eclampsia...(PENS). My data is all cleaned, therefore all DX codes have decimal points in the data file. Unfortunately when I tab the codes output to check on them, it includes codes with decimals and also codes without, with different totals for each. Very confusing. Any ideas why? This is code that has been copied and pasted and used a bunch of times and for the life of me I can't figure out where it got messed up. I'm also having a problem with total in case anyone notices but I think I can figure that out. See code and output below:

    code:

    gen flag = 0
    foreach v of varlist I10_DX1 - I10_DX40 {
    icd10cm generate flag_`v' = `v', range (O13.1/O13.9 O14.0 O14.9)
    replace flag = flag_`v' if flag_`v' > flag & flag_`v' != .
    }

    egen max1=rowmax(flag_I10_DX*)
    tab max1, m

    egen total1=rowtotal(flag_I10_DX*)
    tab total1, m

    gen codes1 =I10_DX1 if flag_I10_DX1 == 1
    foreach v of varlist I10_DX1 - I10_DX40 {
    replace codes1 = `v"' if flag_`v' == 1
    }

    tab codes1, m

    rename codes1 codes_PENS
    rename flag ICD_PENS
    rename max1 max_PENS
    rename total1 total_PENS
    drop flag_I10_DX*

    tab codes_PENS, m

    Output:


    codes_PENS | Freq. Percent Cum.
    ------------+-----------------------------------
    | 3,112,985 94.41 94.41
    O13.1 | 113 0.00 94.41
    O13.2 | 867 0.03 94.43
    O13.3 | 22,532 0.68 95.12
    O13.4 | 118,936 3.61 98.73
    O13.5 | 3,040 0.09 98.82
    O13.9 | 1,210 0.04 98.85
    O131 | 50 0.00 98.86
    O132 | 355 0.01 98.87
    O133 | 28,542 0.87 99.73
    O134 | 7,997 0.24 99.97
    O135 | 175 0.01 99.98
    O139 | 668 0.02 100.00
    ------------+-----------------------------------
    Total | 3,297,470 100.00



  • #2
    actually never mind thanks this has been resolved.

    Comment

    Working...
    X