Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: stubwidth in table


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: stubwidth in table
Date   Thu, 30 Oct 2008 09:56:05 -0000

I like Joseph's approach, so much so that I embedded it in a program
called -groups- which you can download from SSC. -groups- calculates
frequencies, percents, etc. on the fly, but calls -list- to show the
results. Its default stubwidth (or equivalent) is good enough for
moderately long string variables and you can reach through and call up
options of -list- to tune the display. There are other bells and
whistles too, including a -fillin- option to show cross-combinations
that don't occur in the data explicitly in the display with frequency
zero. (Why I didn't call that option -zero-, as with the original
version of -contract-, I don't know. Next time I hit the code of
-groups-, I will make -zero- a synonym of -fillin-.) Anyway, 

. ssc desc groups
. ssc inst groups 

Nick 
n.j.cox@durham.ac.uk 

Joseph Coveney

You might want to try -table-.  It can adjust widths.  If I recall
correctly, it won't show zero-count cells, however.

An alternative is to use -contract- and then -list , string(40)-.

sysuse auto, clear
preserve
decode foreign, generate(car_type)
contract car_type, freq(count)
foreach var of varlist _all {
    char define `var'[varname] "`: variable label `var''"
}
list , noobs abbreviate(20) string(40) subvarname
restore
exit

Haiyong Xu 

I want to generate a frequency table for one variable which has long
(may
 >40 digits, the maximum of stubwidth) string value. Is there any way to
display the complete value of the variable in the table?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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