Hello,
I've been reading as much as I can about the ICD9 and 10 functions in Stata. However, I have a 13 year dataset spanning the ICD transition period and have both 9 and 10 codes in one column (long format). I've tried to clean using both the icd9 and 10 commands separately but Stata seems to get very hung up on codes that are too long or format is not perfect. Which seems odd to me as it could easily skip that dx and move on to the next one. I have also tried running both commands, creating 2 new vars and running a cross tab to see what gets missed but again, Stata skips a lot of legit looking codes simply because they appear too long or have an invalid first char. I simply want to have Stata recognize the codes and create a new var with code value and descriptive text. I'm primarily interested in only the first 3-4 characters of each code. Do I have to trim the dx codes myself first?
Thanks,
Ben
I've been reading as much as I can about the ICD9 and 10 functions in Stata. However, I have a 13 year dataset spanning the ICD transition period and have both 9 and 10 codes in one column (long format). I've tried to clean using both the icd9 and 10 commands separately but Stata seems to get very hung up on codes that are too long or format is not perfect. Which seems odd to me as it could easily skip that dx and move on to the next one. I have also tried running both commands, creating 2 new vars and running a cross tab to see what gets missed but again, Stata skips a lot of legit looking codes simply because they appear too long or have an invalid first char. I simply want to have Stata recognize the codes and create a new var with code value and descriptive text. I'm primarily interested in only the first 3-4 characters of each code. Do I have to trim the dx codes myself first?
Thanks,
Ben
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float recid byte dxnum str7 dx byte icd9prob 1 1 "S51811A" 4 1 2 "X991XXA" 4 1 3 "Z8249" 5 1 4 "Y939" 5 1 5 "Y929" 5 1 6 "Y999" 5 2 1 "S022XXA" 4 2 2 "R220" 5 2 3 "H538" 5 2 4 "X990XXA" 4 2 5 "Y999" 5 2 6 "Z23" 5 2 7 "J45909" 4 2 8 "Z833" 5 2 9 "Y042XXA" 4 2 10 "Y0701" 5 2 11 "Y92009" 4 3 1 "S272XXA" 4 3 2 "J9601" 5 3 3 "Z66" 5 end label values icd9prob __icd_9 label def __icd_9 4 "Code too long", modify label def __icd_9 5 "Invalid 1st char (not 0-9, E, or V)", modify
Comment