This is my first post in the Stata list and I have tried not to break the rules here, so forgive me if this is too elementary. I have read books (2!), searched online and asked biostatisticians for this answer and haven't found one yet, so I'm trying this forum as a last effort.

I have several sets of medical data from the military healthcare system (I'm an active duty medical researcher). I have reference tables of ICD9/ICD10 codes in excel sheets that are categorized according to different taxonomies. For example, I have all the codes for an ankle sprain labeled as such, all the codes for rotator cuff tears labeled, codes for heat injuries, codes for respiratory infections, etc. For example, I have a dataset that includes all the medical care for a group of individuals from 2014-2018. I need to be able to flag all the encounters for certain diagnostic categories. I.e. how many individuals had ankle sprains, how many surgeries did they have? What was their cost of care? What kind of care did they have, etc...

The way I've been doing it is writing commands in Stata to create dummy variables (Yes/No) for whether or not an individual had one of these diagnoses. Then more code to total up cost variables, etc... It works fine, but it's extremely cumbersome and time-consuming to write all the code for all these different diagnostic categories. I've talked with epidemiologists who use SAS who are able to simply write queries in SAS that then reference a table with the codes categorized. He told me he believes this can be done in Stata as well. What I mean is that I somehow load an excel file with these codes categorized in a taxonomy (i.e. Body region1, body region 2, group, subgroup, in columns)...and then somehow reference this excel file in a way that let's me flag encounters in my healthcare dataset according to this taxonomy.

As you can see I'm struggling to articulate the question. All I'm looking for is a yes/no if this is even possible. If it is perhaps some insight into where to look for instruction in this.

Thanks so much for reading this. I look forward to contributing to this great community when I get a bit more seasoned and have something to offer!

Ben