.-
help for icd9
.-


ICD-9-CM diagnostic codes
-------------------------

	^icd9^ ^check^ varname [^,^ ^any^ ^l^ist ^g^enerate^(^newvar^)^ ]

	^icd9^ ^clean^ varname [^,^ ^d^ots ^p^ad ]

	^icd9^ ^gen^erate newvar ^=^ varname^,^ ^m^ain 
	^icd9^ ^gen^erate newvar ^=^ varname^,^ ^d^escription [^l^ong ^e^nd]
	^icd9^ ^gen^erate newvar ^=^ varname^,^ ^r^ange^(^icd9rangelist^)^

	^icd9^ ^l^ookup icd9rangelist
	^icd9^ ^sea^rch [^"^]text[^"^] [[^"^]text[^"^] ...] [^,^ ^or^ ]

	^icd9^ ^tab^ulate varname [...]                        (see help @tabulate@)
	^icd9^ ^table^    varname [...]                        (see help @table@)

	^icd9^ ^install,^ {^net^ | ^cd^} [^replace^]


where icd9rangelist is

	icd9code                  (meaning the particular code)
	icd9code^*^                 (meaning all codes starting with)
	icd9code^/^icd9code         (meaning the code range)

or any combination of the above, such as "^001* 018/019 E* 018.02^" Note that
icd9codes must be typed with leading zeros:  ^1^ is an error; type ^001^.


Description
-----------

^icd9^ assists with working with ICD-9-CM codes.  ICD-9-CM refers to the fifth
edition of the International Classification of Deseases, 9th revision,
Clinical Modification.

^icd9^ ^check^ verifies that already existing variable varname contains valid
ICD-9 codes.  If not, ^icd9^ ^check^ provides a full report on the problems.
^icd9^ ^check^ is useful for tracking down problems when any of the other ^icd9^
commands tell you "variable does not contain ICD-9 codes".  ^icd9^ ^check^ is a
little more thorough, too, in that it verifies that each of the recorded codes
actually exists in the official list.

^icd9^ ^clean^ also verifies that already existing variable varname contains valid
ICD-9 codes and, if it does, ^icd9^ ^clean^ modifies the variable to contain the
codes in either of two standard formats.  There are numerous ways of writing
the same ICD-9 code and this routine is designed to (1) ensure consistency and 
(2) make output look better.  Use of this ^icd9^ ^clean^ is optional; all ^icd9^
commands work equally well with cleaned or uncleaned codes.

^icd9 generate^ produces new variables based on already existing variables
containing (cleaned or uncleaned) ICD-9 codes.  ^icd9 genereate, main^
produces newvar containing the "main" code.  ^icd9 generate, description^
produces newvar containing a textual description of the ICD-9 code.  ^icd9^
^generate, range()^ produces numeric newvar containing 1 if varname records an
ICD-9 code in the range listed and 0 otherwise.

^icd9 lookup^ and ^icd9 search^ are utility routines useful interactively.  ^icd9^
^lookup^ simply displays descriptions of codes specified on the command line, so
if you have a yearning to know what E913.1 means, you can type "^icd9 lookup^
^e913.1^".  Whatever data you have in memory is irrelevant -- and remains
unchanged -- when using ^icd9 lookup^.  ^icd9 search^ is like ^icd9 lookup^ except
that it turns the problem around; ^icd9 search^ looks for relevant ICD-9 codes
from the description given on the command line.

^icd9 tabulate^ and ^icd9 table^ are Stata's @tabulate@ and @table@ commands.  The
first variable specified, however, is assumed to contain ICD-9 codes.  The 
resulting table will include the text describing the codes.

^icd9^ ^install^ has to do with installation of the icd9 command.  See the section
Installation below.

Note, ICD-9 codes are commonly written two ways, with and without periods.
One can write 001, 86221, E8008, and V822, or one can write 001., 862.21,
E800.8, and V82.2.  The ^icd9^ command does not care which syntax you use nor
even whether you are consistent.  Case also is irrelevant:  v822, v82.2, V822,
and V82.2 are all equivalent.  Codes may be recorded with or without leading
and trailing blanks.


Options for use with ^icd9 check^
-------------------------------

^any^ tells ^icd9 check^ to verify the codes fit the format of ICD-9 codes but to
    skip checking whether the codes are actually valid.  This makes ^icd9 check^
    run faster.  For instance, 230.52 (or 23052 if you prefer) looks to be
    valid, but in fact there is no such ICD-9 code.  Without the ^any^ option,
    230.52 (23052) would be flagged as an error.  With ^any^, 230.52 (23052)
    is not considered an error.

^list^ tells ^icd9 check^ that invalid codes found in the data -- 1, 1.1.1, and 
    perhaps 230.52 assuming ^any^ is not also specified -- are to be indvidually
    listed.

^generate(^newvar^)^ specifies that ^icd9 check^ is to create new variable newvar
    containing, for each observation, 0 if the code is valid and a number from 
    1 to 10 if not.  The positive numbers indicate the kind of problem and 
    correspond to the listing produced by icd9 check.  For instance, 10 means
    the code could be valid, it just turns out not to be on the official list.



Options for use with ^icd9 clean^
-------------------------------

^dots^ specifies whether periods are to be included in the final format.  Do you
    wish codes recorded, for instance, 86221 or 862.21?  Without the ^dots^
    option, the former format is used.  With the ^dots^ option, the later format
    is used.

^pad^ specifies that that the codes are to be padded with spaces, front and
    back, to make the codes line up in verical listings.  Specifying ^pad^ makes
    the resulting codes look better when used with most other Stata commands.


Technical note ----------------------------------------------------------------
    If you specify ^pad^, the following character positions are used:

       position   ^nodot^                     position   ^dot^
       --------------------------------     --------------------------------
           1      ^E^ or " "                      1      ^E^ or " "
          2-4     rest of main code            2-4     rest of main code
          5-6     detail code or spaces         5      "^.^" or " "
                                               6-7     detail code or spaces

    If pad is not specified, the ICD-9 code is written without leading or
    trailing blanks, meaning

       position     ^nodot^
       -------------------------------------------
       1-3 or 1-4   Optional ^E^ + rest of main code
       4-5 or 5-6   detail code or nothing

    and 

       position     ^nodot^
       -------------------------------------------
       1-3 or 1-4   Optional ^E^ + rest of main code
        4  or  5    "^.^" or nothing 
       5-6 or 6-7   detail code or nothing
.-


Options for use with ^icd9 generate^
----------------------------------

^main^, ^description^, and ^range()^ specify what icd9 genereate is to calculate.
In all cases, varname specifies a variable containing ICD-9 codes.

^main^ specifies that the "main" code is to be extracted from the ICD-9 code; 
    The main code is usually the first three or four characters of the ICD-9
    code (the characters before the dot if the code has dots), but that is 
    not the rule ^icd9 generate^ uses for extracting main codes.  ^icd9 generate^
    does not care whether the code is padded with blanks in front or how 
    strangely it might be written; ^icd9 generate^ will find the main code and 
    extract it.  The resulting variable is itself an ICD-9 code and may be
    used with the other ^icd9^ subcommands.  This includes ^icd9 generate,
    main^, because main codes of main codes are main codes.

^description^ creates newvar containing descriptions of the ICD-9 codes. 

    ^long^ is for use with ^description^.  It specifies that the new variable, 
    in addition to containing the text describing the code, is to contain 
    the code, too.  Without ^long^, newvar in an observation might contain
    "bronchus injury-closed".  With long, it would contain 
    " 862.21  bronchus injury-closed".

    ^end^ modifies ^long^ (specifying ^end^ implies ^long^) and places the code at 
    the end of the string:  "bronchus injury-closed  862.21".  
    

^range()^ allows you to easily create indicator variables equal to 1 when the
    ICD-9 code is in the range specified.



Remarks
-------


Installation
------------

To work, ^icd9^ needs a dataset that records the valid ICD-9 diagnostic codes.
This dataset is stored with the ^icd9^ command but a shortcoming of the net
command does not allow this dataset to be installed with the ^icd9^ ado-file.

^icd9^ install completes the installation by copying the dataset to the
directory in which icd9.ado is stored.

To complete the installation of ^icd9^, type 

	. ^icd9 install, net^            (copies dataset from www.stata.com)
or
	. ^icd9 Install, cd^             (copies dataset from current directory)

With the ^net^ option, ^icd9^ ^install^ will find the dataset at the Stata web site.
Typing "^icd9 install, net^" is the easier way to obtain the dataset.

With the ^cd^ option, ^icd9^ ^install^ assumes the dataset (named icd9code.dta) is
in the current directory.  You arrange for icd9code.dta to be in the current
directory by going back to the source from which you obtained ^icd9^ and typing
^net get^ rather than ^net install^.

^icd9^ ^install^'s ^replace^ option allows you to reinstall the ICD-9 code dataset
later should it ever need updating.


ICD-9 Diagnostic codes
----------------------

The format of an ICD-9 diagnostic code is 

        [blanks]{^0^-^9^,^V^,^v^}{^0^-^9^}{^0^-^9^}[^.^][^0^-^9^[^0^-^9^]][blanks]
or
        [blanks]^{^E^,^e^}{^0^-^9^}{^0^-^9^}{^0^-^9^}[^.^][^0^-^9^[^0^-^9^]][blanks]

^icd9^ can deal with ICD-9 codes written any of the ways the above allows.
Items in square brackets are optional.  The code might start with some number
of blanks.  Braces {} indicates required.  The code either then has a digit
from ^0^ to ^9^ or the letter ^V^ (upper or lower case) (first line) or it has
the letter ^E^ (upper or lower case, second line).  After that, it has two
more digits, perhaps followed by a period, and after that it may have up to
two more digits (perhaps followed by more blanks).

All off the following meet the above definition:

	^001^
	^001.^
	   ^001^
	^001.9^
                 ^0019^
        ^86222^
        ^862.22^
        ^E800.2^
        ^e8002^
        ^V82^
	^v82.2^
	^V822^

Meeting the above definition does not make the code valid.  There are 233,100
possible codes meeting the above definition, of which 15,186 are currently
defined.

Examples of currently defined codes include 

	code       desc                      
	-------------------------------------
         001        cholera*
         001.0      cholera d/t vib cholerae
         001.1      cholera d/t vib el tor
         001.9      cholera nos
	 [...]
	 002        typhoid/paratyphoid fev*   
	 002.0      typhoid fever              
	 002.1      paratyphoid fever a        
	 002.2      paratyphoid fever b        
	 002.3      paratyphoid fever c        
	 002.9      paratyphoid fever nos      
	 [...]
	 998        oth surgical compl nec*    
	 998.0      postoperative shock        
	 998.1      hemorr complic procedure*  
	 998.11     hemorrhage complic proc    
	 998.12     hematoma complic proc      
	 998.13     seroma complicting proc    
	 998.2      accidental op laceration   
	 [...]
	 999        complic medical care nec*  
	 [...]
	 V01        communicable dis contact*  
	 V01.0      cholera contact            
	 V01.1      tuberculosis contact       
	 V01.2      poliomyelitis contact      
	 V01.3      smallpox contact           
	 V01.4      rubella contact            
	 V01.5      rabies contact             
	 V01.6      venereal dis contact       
	 V01.7      viral dis contact nec      
	 V01.8      communic dis contact nec   
	 V01.9      communic dis contact nos   
	 [...]
	 V82        screen-other conditions*   
	 V82.0      screen for skin cond       
	 V82.1      screen-rheumatoid arthr    
	 V82.2      screen-rheumat dis nec     
	 V82.3      screen-cong hip dislocat   
	 V82.4      mat pstntl scr-chrm anom   
	 V82.5      screen-contamination nec   
	 V82.6      multiphasic screening      
	 V82.8      screen for condition nec   
	 V82.9      screen for condition nos   
	E800       rr collision nos*          
	E800.0     rr collision nos-employ    
	E800.1     rr coll nos-passenger      
	E800.2     rr coll nos-pedestrian     
	E800.3     rr coll nos-ped cyclist    
	E800.8     rr coll nos-person nec     
	E800.9     rr coll nos-person nos     
	E997       war inj-unconven war nec*  
	E997.0     war injury:lasers          
	E997.1     war injury:biol warfare    
	E997.2     war injury:gas/fum/chem    
	E997.8     war inj-unconven war nec   
	E997.9     war inj-unconven war nos   
	E998       war inj:post war operat    
	E999       late eff of war injury     
	-------------------------------------

"Main codes" refer to ICD-9 to the left of the period.  001, 002, ..., 999,
V01, ..., V82, E800, ..., E999 are main codes.  There are 1,182 main codes.

The main code corresponding to a detailed code can be obtained by taking the
part of the code to the left of the period, except for codes beginning with
176, 764, 765, V29, and V69.  Those main codes are not defined and yet, there
are more detailed codes under them:

    176      CODE DOES NOT EXIST, but 8 codes starting with 176 do exist:
             kaposi's sarcoma (Stata code)
    176.0    skin - kaposi's sarcoma
    176.1    sft tisue - kpsi's srcma
    176.2    palate - kpsi's sarcoma
    176.3    gi sites - kpsi's srcoma
    176.4    lung - kaposi's sarcoma
    176.5    lym nds - kpsi's sarcoma
    176.8    spf sts - kpsi's sarcoma
    176.9    kaposi's sarcoma nos

    764      CODE DOES NOT EXIST, but 44 codes starting with 764 do exist:
             light-for-dates (Stata code)
    764.0    lt-for-dates w/o fet mal*
    764.00   light-for-dates wtnos
    764.01   light-for-dates <500g
    764.02   lt-for-dates 500-749g
    764.03   lt-for-dates 750-999g
    [...]
    764.09   lt-for-dates 2500+g
    764.1    lt-for-dates w fetal mal*
    764.10   lt-for-date w/mal wtnos
    764.11   lt-for-date w/mal <500g
    764.12   lt-date w/mal 500-749g
    [...]
    764.19   lt-for-date w/mal 2500+g
    764.2    fet mal w/o lt-for-dates*
    764.20   fetal malnutrition wtnos
    764.21   fetal malnutrition <500g
    764.22   fetal malnutr 500-749g
    [...]
    764.29   fetal malnutr 2500+g
    764.9    fetal growth retard nos*
    764.90   fet growth retard wtnos
    764.91   fet growth retard <500g
    764.92   fet growth ret 500-749g
    [...]
    764.99   fet growth ret 2500+g

    765      CODE DOES NOT EXIST, but 22 codes starting with 765 do exist:
    765.0    extreme immaturity*
    765.00   extreme immatur wtnos
    765.01   extreme immatur <500g
    765.02   extreme immatur 500-749g
    [...]
    765.09   extreme immat 2500+g
    765.1    other preterm infants*
    765.10   preterm infant nec wtnos
    765.11   preterm nec <500g
    765.12   preterm nec 500-749g
    [...]
    765.19   preterm nec 2500+g

    V29      CODES DOES NOT EXIST, but 6 codes stating with V29 do exist:
             nb suspct cnd (Stata code)
    V29.0    nb obsrv suspct infect
    V29.1    nb obsrv suspct neurlgcl
    V29.2    obsrv nb suspc resp cond
    V29.3    nb obs genetc/metabl cnd
    V29.8    nb obsrv oth suspct cond
    V29.9    nb obsrv unsp suspct cnd

    V69      CODE DOES NOT EXIST, but 6 codes starting with V69 do exist:
             lifestyle (Stata code)
    V69.0    lack of physical exercse
    V69.1    inapprt diet eat habits
    V69.2    high-risk sexual behavr
    V69.3    gambling and betting
    V69.8    oth prblms rltd lfstyle
    V69.9    prblm rltd lfstyle nos

^icd9^'s solution is to define 4 new codes:

    176      kaposi's sarcoma (Stata)*
    764      light-for-dates (Stata code)*
    765      immat & preterm (Stata)*
    V29      nb suspct cnd (Stata code)*
    V69      lifestyle (Stata code)*

Thus, there are 15,186+5=15,191 codes of which 1,181+5=1,186 are main codes.



Descriptions
------------

The descriptions given for each of the codes is as found in the original data
(with the addition of the five new codes by us).

An astrisk on the end of a description indicates that the corresponding ICD-9
diagnostic code has subcategories.




Examples
--------

!! To be written


Also see
--------

!! To be filled in
