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

Re: st: codebook with percentages


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: codebook with percentages
Date   Wed, 26 Jan 2005 19:29:00 +0000

I think what Thomas is trying to do is known as resultsset processing. A resultsset is a dataset produced as output by a Stata command. In Thomas' case, what is required is a dataset with 1 observation per value per variable, and data on variable labels, value labels, frequencies and percentages. This dataset can then be listed and/or used to create an output table for publication.

It should be possible to create what Thomas wants using the packages -xcontract- and -descsave-, possibly together with the packages -sencode-, -sdecode- and -factmerg-. All these packages can be downloaded within Stata using the -ssc- command.

More information about resultsset processing can be found in .pdf files downloadable from my website (see my signature below), either using a browser or using Stata. If in Stata you type

findit resultsset

then you will find the handout for my survey talk "From datasets to resultssets in Stata", presented at the 2004 UK Stata user meeting. If you type

findit enduser

then you will find a pre-publication draft of a Stata Journal article on the subject (Newson, 2003).

I hope this helps.

Roger


References

Newson R. 2003. Confidence intervals and p-values for delivery to the end user. The Stata Journal 3(3): 245-269.





>>> [email protected] 1/11/2005 10:03:51 AM >>>
I am trying to write a codebook, containing the variable name,
variable
label and the frequency, percent, percent of nonmissing values, value,
and
label of each value.

I would like to have something like this:

q1 state of economy
------------------------------------------------------------------
Value Label Frequency Percent Per(nonm) Cum
------------------------------------------------------------------
1 gotten better 117 6.46% 6.90% 6.46%
2 stayed the same 472 26.08% 27.83% 32.54%
3 gotten worse 1107 61.16% 65.27% 93.70%
. 114 6.30% 100.00%
------------------------------------------------------------------
  1810 100.00% 100.00%

I've tried the commands codebook- and -cb2html-, but codebook- only
displays value, label and frequency and -cb2html- additionally displays

percentages, but not the percentage of nonmissings and cumulative
percentages. Ideally I would like to have displayed the percentages of
all
"valid" categories, where "valid" could be defined as(say) q*<90.

I could get these by using tab- for all variables and copy it, but I
was
wondering if there is a way to do this automatically.

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

*
*   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