help icd9, help icd9p dialogs: check clean generate
lookup search query
-------------------------------------------------------------------------------
Title
[D] icd9 -- ICD-9-CM diagnostic and procedure codes
Syntax
Verify that variable contains defined codes
{icd9|icd9p} check varname [, any list generate(newvar)]
Verify and clean variable
{icd9|icd9p} clean varname [, dots pad]
Generate new variable from existing variable
{icd9|icd9p} generate newvar = varname, main
{icd9|icd9p} generate newvar = varname, description [long end]
{icd9|icd9p} generate newvar = varname, range(icd9rangelist)
Display code descriptions
{icd9|icd9p} lookup icd9rangelist
Search for codes from descriptions
{icd9|icd9p} search ["]text["] [["]text["] ...] [, or]
Display ICD-9 code source
{icd9|icd9p} query
where icd9rangelist is
icd9code (the particular code)
icd9code* (all codes starting with)
icd9code/icd9code (the code range)
or any combination of the above, such as 001* 018/019 E* 018.02.
icd9codes must be typed with leading zeros: 1 is an error; type 001
(diagnostic code) or 01 (procedure code).
icd9 is for use with ICD-9 diagnostic codes, and icd9p for use with
procedure codes. The two commands' syntaxes parallel each other.
Menu
{icd9|icd9p} check
Data > Other utilities > ICD9 utilities > Verify variable is valid
{icd9|icd9p} clean
Data > Other utilities > ICD9 utilities > Clean and verify variable
{icd9|icd9p} generate
Data > Other utilities > ICD9 utilities > Generate new variable from
existing
{icd9|icd9p} lookup
Data > Other utilities > ICD9 utilities > Display code descriptions
{title:{icd9|icd9p} search
Data > Other utilities > ICD9 utilities > Search for codes from
descriptions
{icd9|icd9p} query
Data > Other utilities > ICD9 utilities > Display ICD-9 code source
Description
icd9 and icd9p help when working with ICD-9-CM codes.
ICD-9 codes come in two forms: diagnostic codes and procedure codes. In
this system, 001 (cholera) and 941.45 (deep 3rd deg burn nose) are
examples of diagnostic codes, although some people write (and datasets
record) 94145 rather than 941.45. Also, 01 (incise-excis brain/skull)
and 55.01 (nephrotomy) are examples of procedure codes, although some
people write 5501 rather than 55.01. icd9 and icd9p understand both ways
of recording codes.
Important note: What constitutes a valid ICD-9 code changes over time.
For the rest of this help file, a defined code is any code that is either
currently valid, was valid at some point since version V16 (effective
October 1, 1998), or has meaning as a grouping of codes. Some examples
would help. The diagnosis code 001, though not valid on its own, is
useful because it denotes cholera. It is kept as a defined code whose
description ends with an asterisk (*). The diagnosis code 645.01 was
deleted between versions V16 and V18. It remains as a defined code, and
its description ends with a hash mark (#).
icd9 and icd9p parallel each other; icd9 is for use with diagnostic
codes, and icd9p for use with procedure codes.
icd9[p] check verifies that existing variable varname contains defined
ICD-9 codes. If not, icd9[p] check provides a full report on the
problems. icd9[p] check is useful for tracking down problems when any of
the other icd9[p] commands tell you that the "variable does not contain
ICD-9 codes". icd9[p] check verifies that each recorded code actually
exists in the defined code list.
icd9[p] clean also verifies that existing variable varname contains
defined ICD-9 codes and, if it does, icd9[p] clean modifies the variable
to contain the codes in either of two standard formats. All icd9[p]
commands work equally well with cleaned or uncleaned codes. There are
many ways of writing the same ICD-9 code, and icd9[p] clean is designed
to ensure consistency and to make subsequent output look better.
icd9[p] generate produces new variables based on existing variables
containing (cleaned or uncleaned) ICD-9 codes. icd9[p] generate, main
produces newvar containing the main code. icd9[p] generate, description
produces newvar containing a textual description of the ICD-9 code.
icd9[p] generate, range() produces numeric newvar containing 1 if varname
records an ICD-9 code in the range listed and 0 otherwise.
icd9[p] lookup and icd9[p] search are utility routines that are useful
interactively. icd9[p] lookup simply displays descriptions of the codes
specified on the command line, so to find out what diagnostic E913.1
means, you can type icd9 lookup e913.1. The data that you have in memory
are irrelevant -- and remain unchanged -- when you use icd9[p] lookup.
icd9[p] search is similar to icd9[p] lookup, except that it turns the
problem around; icd9[p] search looks for relevant ICD-9 codes from the
description given on the command line. For instance, you could type icd9
search liver or icd9p search liver to obtain a list of codes containing
the word "liver".
icd9[p] query displays the identity of the source from which the ICD-9
codes were obtained and the textual description that icd9[p] uses.
ICD-9 codes are commonly written two ways: with and without periods. For
instance, with diagnostic codes, you can write 001, 86221, E8008, and
V822, or you can write 001., 862.21, E800.8, and V82.2. With procedure
codes, you can write 01, 50, 502, and 5021, or 01., 50., 50.2, and 50.21.
The icd9[p] command does not care which syntax you use or 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.
icd9[p] works with V27, V26, V25, V24, V22, V21, V19, V18, and V16 codes.
Options for icd9[p] check
any tells icd9[p] check to verify that the codes fit the format of ICD-9
codes but not to check whether the codes are actually defined. This
makes icd9[p] check run faster. For instance, diagnostic code 230.52
(or 23052, if you prefer) looks valid, but there is no such ICD-9
code. Without the any option, 230.52 would be flagged as an error.
With any, 230.52 is not an error.
list reports any invalid codes that were found in the data by icd9[p]
check. For example, 1, 1.1.1, and perhaps 230.52, if any is not
specified, are to be individually listed.
generate(newvar) specifies that icd9[p] check create new variable newvar
containing, for each observation, 0 if the code is defined and a
number from 1 to 10 otherwise. The positive numbers indicate the
kind of problem and correspond to the listing produced by icd9[p]
check. For instance, 10 means that the code could be valid, but it
turns out not to be on the list of defined codes.
Options for icd9[p] clean
dots specifies whether periods are to be included in the final format.
Do you want the diagnostic codes recorded, for instance, as 86221 or
862.21? Without the dots option, the 86221 format would be used.
With the dots option, the 862.21 format would be used.
pad specifies that the codes are to be padded with spaces, front and
back, to make the codes line up vertically in listings. Specifying
pad makes the resulting codes look better when used with most other
Stata commands.
Options for icd9[p] generate
main, description, and range(icd9rangelist) specify what icd9[p] generate
is to calculate. varname always specifies a variable containing
ICD-9 codes.
main specifies that the main code be extracted from the ICD-9 code.
For procedure codes, the main code is the first two characters.
For diagnostic codes, the main code is usually the first three or
four characters (the characters before the dot if the code has
dots). In any case, icd9[p] generate does not care whether the
code is padded with blanks in front or how strangely it might be
written; icd9[p] 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[p] subcommands. This includes icd9[p]
generate, main.
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,
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(icd9rangelist) allows you to create indicator variables equal
to 1 when the ICD-9 code is in the inclusive range specified.
Option for icd9[p] search
or specifies that ICD-9 codes be searched for entries that contain any
word specified after icd9[p] search. The default is to list only
entries that contain all the words specified.
Examples
. icd9 lookup 526.4
. icd9 lookup 526/527
. icd9 search jaw disease
. webuse patients
. icd9 check diag1
. icd9 check diag1, gen(prob)
. list patid diag1 if prob
. icd9 clean diag2
. icd9 clean diag2, dots
. icd9p clean proc1, dots
. icd9p check proc1
. icd9 gen td1 = diag2, desc
. icd9p gen tp2 = proc2, desc
. icd9 gen main2 = diag2, main
Saved results
icd9 and icd9p save the following in r():
Scalars
r(e#) number of errors of type #
r(esum) total number of errors
Also see
Manual: [D] icd9