Statalist The Stata Listserver


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

Re: st: Truncating in two-way tables


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Truncating in two-way tables
Date   Mon, 24 Apr 2006 19:13:34 +0900

Sara Mottram wrote:

I am trying to tabulate certain conditions related to the chest
(read_trm), gathered from medical records, against whether or not a
person describes themselves as having a chest condition (yes/no). I have
included my code and a small amount of the table below (the -if-
statement is there to chose only those conditions defined as being chest
related). My problem is that the names of the conditions are being
truncated and so I cannot tell what all of them say.
I notice that if I tabulate only the condition (read_trm) and do not
include the second variable (i.e. a one-way table), I get more
characters in the table but it is still truncated. I think this is to do
with space in the results window, but is there any way that I can change
this so that I can read all of the entries under 'Read term'?

--------------------------------------------------------------------------------

You can try -table-, or else -contract- and then -list , string()-.  I
agree, though:  -tabulate- really ought to have cell width options just
as -table- does; the alternatives aren't otherwise so good as -tabulate-.

Joseph Coveney

clear
set more off
input str244 read_trm str244 a101a int count
"Chron obstruct pulmonary obstructive disease" "Yes" 1
"Pleural condition, unclassified" "No" 1
"Abscess of lung/mediastinum" "No" 1
"Acute Tonsilitis" "No" 1
"Acute bacterial pharyngitis" "No" 1
"Acute bacterial pharyngitis" "Yes" 1
"Acute bronchiolitis" "Yes" 1
"Acute bronchitis" "No" 69
"Acute bronchitis" "Yes" 53
"Acute erythematous tonsillitis" "No" 1
"Acute exacerbation of This" "No" 1
"Acute exacerbation of This" "Yes" 15
"Acute exacerbation of That" "No" 3
"Acute exacerbation of That" "Yes" 45
"Acute exacerbation of The Other" "Yes" 3
"Acute follicular tonsillitis" "No" 2
end
compress
label variable read_trm "Read term"
label variable a101a "Chest problems"
tabulate read_trm a101a [fweight = count]
generate byte k = 1
table read_trm a101a [fweight = count], contents(n k)
preserve
contract read_trm a101a [fweight=count], zero
reshape wide _freq, i(read_trm) j(a101a) string
renpfix _freq
char read_trm[varname] "`: variable label read_trm'"
list, noobs separator(0) subvarname
restore
exit

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index