Was not sure how to title this but the issue/question I have is this:
I have data on hospitalizations and ED visits where each row contains 25 variables, each of which is an ICD-10 diagnostic code. The goal of a preliminary step in the analyses is to assign each specific ICD-10 diagnostic code to one of 25 major diagnostic categories (MDCs). Each MDC subsumes many (50 or more) ICD-10 codes. An example of one MDC would be 'Alcohol Drug Use and Induced Mental Disorders. An ICD-10 diagnosis of alcohol use disorder or cannabis use disorder would both be flagged as being in this MDC. The MDC codes are now stored in an Excel file with each of the 25 tabs containing the ICD-10 codes that are in each MDC. I have attached the Excel file with the MDC codes to show its structure.
I want to write a program that loops through each of the 25 ICD-10 codes in each record, compares that code to the ICD-10 codes within each MDC and when a match is found, create a flag variable to indicate which MDC group that diagnosis is in. So one of a person's ICD-10 diagnoses was for an alcohol use disorder, a variable for MDC20 would be set to 1 for that record and the program would move on to the next ICD-10 code.
What is puzzling to me is how to incorporate the MDC codes, which are in the Excel workbook tabs into the looping structure.
If anyone has done something like this or has suggestions how to create the code, I would be most obliged.
Thanks.
I have data on hospitalizations and ED visits where each row contains 25 variables, each of which is an ICD-10 diagnostic code. The goal of a preliminary step in the analyses is to assign each specific ICD-10 diagnostic code to one of 25 major diagnostic categories (MDCs). Each MDC subsumes many (50 or more) ICD-10 codes. An example of one MDC would be 'Alcohol Drug Use and Induced Mental Disorders. An ICD-10 diagnosis of alcohol use disorder or cannabis use disorder would both be flagged as being in this MDC. The MDC codes are now stored in an Excel file with each of the 25 tabs containing the ICD-10 codes that are in each MDC. I have attached the Excel file with the MDC codes to show its structure.
I want to write a program that loops through each of the 25 ICD-10 codes in each record, compares that code to the ICD-10 codes within each MDC and when a match is found, create a flag variable to indicate which MDC group that diagnosis is in. So one of a person's ICD-10 diagnoses was for an alcohol use disorder, a variable for MDC20 would be set to 1 for that record and the program would move on to the next ICD-10 code.
What is puzzling to me is how to incorporate the MDC codes, which are in the Excel workbook tabs into the looping structure.
If anyone has done something like this or has suggestions how to create the code, I would be most obliged.
Thanks.
Comment