Statalist The Stata Listserver


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

st: tables to include columns for observations that are not present


From   "Christopher W. Ryan" <[email protected]>
To   Statalist <[email protected]>
Subject   st: tables to include columns for observations that are not present
Date   Mon, 27 Feb 2006 11:30:58 -0500

I am trying to use Stata to monitor and analyze the types of encounters that my medical students see in their family medicine course. I use ICPC-2 diagnostic codes to classify the encounters (International Classification of Primary Care).

I have a dataset with the following variables:
studentid
code
textforcode
count

It is easy enough to generate a table with students in rows down the side, and the ICPC codes in columns across the top, with the cells containing the number of times a student has seen that diagnosis:

-table studentid code, contents(sum count)-

My trouble arises with codes that *no* student has seen. With the simple table-related commands with which I'm familiar, no column for such a code will appear in the table. But there are 10 diagnostic codes that I need to monitor, to make sure every student has encountered at least one case of them. So I'd like columns for those ten codes to always appear in the table, irrespective of whether anyone saw those diagnoses. If no one has seen one of those diagnoses, then the cells in that column would all contain the number zero.

Any suggestions how to do this?

Thanks.
--
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
and Wilson Family Practice Residency, Johnson City, NY
cryanatbinghamtondotedu
GnuPG and PGP public keys available at http://pgp.mit.edu

"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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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