[D] icd10cm -- ICD-10-CM diagnosis codes
Syntax
Verify that variable contains defined codes
icd10cm check varname [if] [in] [, checkopts]
Clean variable and verify format of codes
icd10cm clean varname [if] [in], {generate(newvar) | replace}
[cleanopts]
Generate new variable from existing variable
icd10cm generate newvar = varname [if] [in], category [check]
icd10cm generate newvar = varname [if] [in], description [genopts]
icd10cm generate newvar = varname [if] [in], range(codelist) [check]
Display code descriptions
icd10cm lookup codelist [, version(#)]
Search for codes from descriptions
icd10cm search ["]text["] [["]text["] ...] [, searchopts]
Display ICD-10-CM version
icd10cm query
codelist is one of the following:
icd10code (the particular code)
icd10code* (all codes starting with)
icd10code/icd10code (the code range)
or any combination of the above, such as A27.0 G40* Y60/Y69.9.
checkopts Description
-------------------------------------------------------------------------
fmtonly check only format of the codes
summary frequency of each invalid or undefined code
list list observations with invalid or undefined ICD-10-CM
codes
generate(newvar) create new variable marking invalid codes
version(#) fiscal year to check codes against; default is
version(2019)
-------------------------------------------------------------------------
cleanopts Description
-------------------------------------------------------------------------
* generate(newvar) create new variable containing cleaned codes
* replace replace existing codes with the cleaned codes
check check that variable contains ICD-10-CM codes before
cleaning
nodots format codes without a period
pad add space to the right of codes shorter than seven
characters
-------------------------------------------------------------------------
* Either generate() or replace is required.
genopts Description
-------------------------------------------------------------------------
addcode(begin|end) add code to the beginning or end of the description
pad add spaces to the right of the code; must specify
addcode(begin)
nodots format codes without a period; must specify addcode()
check check that variable contains ICD-10-CM codes before
generating new variable
long use long description rather than short
version(#) select description from year #; default is
version(2019)
-------------------------------------------------------------------------
searchopts Description
-------------------------------------------------------------------------
or match any keyword
matchcase match case of keywords
version(#) select description from year #; default is all
-------------------------------------------------------------------------
Menu
Data > ICD codes > ICD-10-CM
Description
icd10cm is a suite of commands for working with ICD-10-CM diagnosis codes
from U.S. federal fiscal year 2016 to the present. To see the current
version of the ICD-10-CM diagnosis codes and any changes that have been
applied, type icd10cm query.
icd10cm check, icd10cm clean, and icd10cm generate are data management
commands. icd10cm check verifies that a variable contains defined
ICD-10-CM diagnosis codes and provides a summary of any problems
encountered. icd10cm clean standardizes the format of the codes.
icd10cm generate can create a binary indicator variable for whether the
code is in a specified set of codes, a variable containing a
corresponding higher-level code, or a variable containing the description
of the code.
icd10cm lookup and icd10cm search are interactive utilities. icd10cm
lookup displays descriptions of the codes specified on the command line.
icd10cm search looks for relevant ICD-10-CM diagnosis codes from keywords
given on the command line.
Options
Options are presented under the following headings:
Options for icd10cm check
Options for icd10cm clean
Options for icd10cm generate
Option for icd10cm lookup
Options for icd10cm search
Options for icd10cm check
fmtonly tells icd10cm check to verify that the codes fit the format of
ICD-10-CM diagnosis codes but not to check whether the codes are
defined.
summary specifies that icd10cm check should report the frequency of each
invalid or undefined code that was found in the data. Codes are
displayed in descending order by frequency. summary may not be
combined with list.
list specifies that icd10cm check list the observation number, the
invalid or undefined ICD-10-CM diagnosis code, and the reason the
code is invalid or whether it is an undefined code. list may not be
combined with summary.
generate(newvar) specifies that icd10cm check create a new variable
containing, for each observation, 0 if the observation contains a
defined code. Otherwise, it contains a number from 1 to 11 if the
code is invalid, 77 if the code is valid only for a previous version,
88 if the code is valid only for a later version, 99 if the code is
undefined, or missing if varname is missing. The positive numbers
indicate the kind of problem and correspond to the listing produced
by icd10cm check.
version(#) specifies the version of the codes that icd10cm check should
reference. # indicates the federal fiscal year for the codes. For
example, use 2016 for federal fiscal year 2016 (FFY-2016), which is
October 1, 2015 to September 30, 2016. icd10cm supports all years
after the United States officially adopted ICD-10-CM. The
appropriate value of # should be determined from the data source.
The default is version(2019).
Warning: The default value of version() will change over time so that
the most recent codes are used. Using the default value rather than
specifying a specific version may change results after a new version
of the codes is introduced.
Options for icd10cm clean
generate(newvar) and replace specify how the formatted values of varname
are to be handled. You must specify either generate() or replace.
generate() specifies that the cleaned values be placed in the new
variable specified in newvar.
replace specifies that the existing values of varname be replaced
with the formatted values.
check specifies that icd10cm clean should first check that varname
contains codes that fit the format of ICD-10-CM diagnosis codes.
Specifying the check option will slow down icd10cm clean.
nodots specifies that the period be removed in the final format.
pad specifies that spaces be added to the end of the codes to make the
(implied) dots align vertically in listings. The default is to
left-align codes without adding spaces.
Options for icd10cm generate
category, description, and range(codelist) specify the contents of the
new variable that icd10cm generate is to create. You do not need to
icd10cm clean varname before using icd10cm generate; it will accept
any supported format or combination of formats.
category specifies to extract the three-character category code from
the ICD-10-CM diagnosis code. The resulting variable may be used
with the other icd10cm subcommands.
description creates newvar containing descriptions of the ICD-10-CM
diagnosis codes.
range(codelist) creates a new indicator variable equal to 1 when the
ICD-10-CM diagnosis code is in the range specified, equal to 0
when the ICD-10-CM diagnosis code is not in the range, and equal
to missing when varname is missing.
addcode(begin|end) specifies that the code should be included with the
text describing the code. Specifying addcode(begin) will prepend the
code to the text. Specifying addcode(end) will append the code to
the text.
pad specifies that the code that is to be added to the description should
be padded spaces to the right of the code so that the start of
description text is aligned for all codes. pad may be specified only
with addcode(begin).
nodots specifies that the code that is added to the description should be
formatted without a period. nodots may be specified only if
addcode() is also specified.
check specifies that icd10cm generate should first check that varname
contains codes that fit the format of ICD-10-CM diagnosis codes.
Specifying the check option will slow down the generate subcommand.
long specifies that the long description of the code be used rather than
the short (abbreviated) description.
version(#) specifies the version of the codes that icd10cm generate
should reference. # indicates the federal fiscal year for the codes.
For example, use 2016 for federal fiscal year 2016 (FFY-2016), which
is October 1, 2015 to September 30, 2016. icd10cm supports all years
after the United States officially adopted ICD-10-CM. The
appropriate value of # should be determined from the data source.
The default is version(2019).
Warning: The default value of version() will change over time so that
the most recent codes are used. Using the default value rather than
specifying a specific version may change results after a new version
of the codes is introduced.
Option for icd10cm lookup
version(#) specifies the version of the codes that icd10cm lookup should
reference. # indicates the federal fiscal year for the codes. For
example, use 2016 for federal fiscal year 2016 (FFY-2016), which is
October 1, 2015 to September 30, 2016. icd10cm supports all years
after the United States officially adopted ICD-10-CM. The
appropriate value of # should be determined from the data source.
The default is version(2019).
Warning: The default value of version() will change over time so that
the most recent codes are used. Using the default value rather than
specifying a specific version may change results after a new version
of the codes is introduced.
Options for icd10cm search
or specifies that ICD-10-CM diagnosis codes be searched for descriptions
that contain any word specified with icd10cm search. The default is
to list only descriptions that contain all the words specified.
matchcase specifies that icd10cm search should match the case of the
keywords given on the command line. The default is to perform a
case-insensitive search.
version(#) specifies the version of the codes that icd10cm search should
reference. # indicates the federal fiscal year for the codes. For
example, use 2016 for federal fiscal year 2016 (FFY-2016), which is
October 1, 2015 to September 30, 2016. icd10cm supports all years
after the United States officially adopted ICD-10-CM.
By default, descriptions for all versions are searched, meaning that
codes that changed descriptions and that have descriptions in
multiple versions that contain the search terms will be duplicated.
To ensure a list of unique code values, specify the version number.
Examples
View the ICD-10-CM diagnosis code version and changes made since icd10cm
was implemented in Stata
. icd10cm query
Setup
. webuse hosp2015
. drop if dmonth < tm(2015m10)
Verify that the variable diag1 has valid codes for federal fiscal year
2016
. icd10cm check diag1, version(2016) summary
Clean the codes to make them more readable, padding the codes with spaces
for alignment and storing the result in new variable pdx
. icd10cm clean diag1, pad generate(pdx)
Stored results
icd10cm check stores the following in r():
Scalars
r(e#) number of errors of type #
r(esum) total number of errors
r(miss) number of missing values
r(N) number of nonmissing values
icd10cm clean stores the following in r():
Scalars
r(N) number of changes
icd10cm lookup and icd10cm search store the following in r():
Scalars
r(N_codes) number of codes found