Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: counting types of diagnoses, and making a table of them, by student

From   "Christopher W. Ryan" <>
To   Statalist <>
Subject   st: counting types of diagnoses, and making a table of them, by student
Date   Tue, 20 Sep 2005 16:45:37 -0400

I run a family medicine clerkship for 3rd year medical students. As the year goes by, I want to start classifying their patient visits by ICPC-2 categories (International Classification of Primary Care.) No doubt some of you are familiar with it: for example, K86 = hypertension, R74 = a cold, etc.

My department uses MS Access for this kind of data tracking, and I can get data from there into Stata via StatTransfer.

I could create a database, one record for each visit, with a field for ICPC diagnosis code. Trouble is, each visit could have 2, 3, or more codes. If I made 3-4 diagnosis fields, into which to enter the ICPC codes, I don't know how I would tabulate them in Stata, to determine how many patients with K86 each student saw; sometimes a K86 might appear in variable diagnosis1, other times in variable diagnosis2, etc.

So I created a bunch of binary (yes/no) fields in the Access database, one for each of the most common ICPC codes. Then in Stata, the following (for example) works great:

--tabstat a97 r74 k86 r78, by(studentid) statistics(sum) columns(variables)--

It gets me the following (excerpted):

studentid a97 r74 k86 r78

1780 0 0 0 0
1781 0 0 0 0
1782 0 0 0 0
5555 1 2 1 0

Total 1 2 1 0

My problem: each variable has a variable label (for example, a97 is "no disease"). I would like the variable labels to appear at the tops of the columns, rather than the variable names, and I can't figure out how to do this.

--desc a97-- confirms that the variable label is in place.

I would appreciate any instructions on how to make the variable labels appear, or on my strategy in general.


Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
and Wilson Family Practice Residency, Johnson City, NY
GnuPG and PGP public keys available at

"If you want to build a ship, don't drum up the men to gather wood, divide the work and give orders. Instead, teach them to yearn for the vast and endless sea." [Antoine de St. Exupery]
* For searches and help try:

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