ICD-9 diagnosis code are usually between 3 to 5 characters (most are digits), so don't go beyond 5 digits guys.
http://www.icd9data.com/2013/Volume1/default.htm
As I recall, University of Manitoba has some sample code here (not great but a good start for the OP)
http://mchp-appserv.cpe.umanitob ... .php?conceptID=1098
OP's question (1) and (2) have already been very well addressed by Board Of Education and yuerqieie. But usually the complete list of ICD-9 codes are not given for a certain disease or condition. For example, your boss may say drug dependency is identified by 304.xx. Do you really want to go through the ICD-9 code book to create yourself a complete list of 5-digit subcodes and write them into a text file, or you'd rather match the first 3 digits only? Also the DX code in your patient database may not be entered as specific as 5 digits, so you have to put the parent code in your list as well. Question (3) is rather simple, you may put
- substr(dx,1,4) between "4330" and "4339" and substr(dx,5,1)="1"
复制代码My point is, you cannot go 100% precise for the subject. I'd rather sacrifice accuracy by using the Manitoba approach so I can sleep better.