[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Question re analysing icd10 code data

From   Katrina Roper <>
Subject   st: Question re analysing icd10 code data
Date   Sun, 27 Apr 2008 18:03:13 +1000

Dear Stata group users,

I have a new data set that I am having difficulty analysing.

The dataset contains 44 fields for icd10 (hospital) codes. There are many hundreds of codes, and these can be put in any one of the columns.
For example, I am interested in the alcohol codes, of which there are 17.
The codes are in string form. The alcohol codes are for example Y90, Y90.0, Y90.1, Y91, Y91.0 etc etc in 17 different forms.

What I want to do is find every time any one of the 17 different alcohol codes appears in any one of the 44 columns.

I tried this:

gen alcohol=.
foreach v of varlist varname1 - varname44 {
replace alcohol=1 if (`v'==Y90|`v'==Y90.1|`v'==Y90.2| until `v'==Y91.9)

: but it didn't work, I suspect maybe because the data is in string form.

Basically is there any way of doing a Boolean type search using Stata to answer the question:
For any column icd1-icd44 find/count where the variable == Y90* | Y91*

Or something like that.

Any advice greatly appreciated.


* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index