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

st: RE: smart way to get a table of frequencies over several variables?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: smart way to get a table of frequencies over several variables?
Date   Thu, 15 May 2003 09:22:21 +0100

Dr. Gawrich, Stefan

I have a frequently updated dataset wich allows up to 6 different
disease codes to be stored for each case, each in a single Variable:
x1...x6
The disease code is numeric, from 11 to 58 (with no or less than 6
diseases, all or some vars are coded missing).


case    x1    x2    x3    x4    x5    x6

    1   16   32     .      .     .     .
    2   12   18     45    56    58     .
    3   17    .     .      .     .     .
    4   .     .     .      .     .     .
....

I need a frequency tables of the occurence of each disease in the
dataset or subgroups  (= the total number of each disease code in
variables x1...x6 for all selectet cases)
The best way I found until now is with reshaping x1...x6 into one
variable (but this takes long with this huge dataset on my PC and
afterwards the original dataset has to be reloaded for further
calculations). Is there a better and "non-destructive" way to get
frequencies over several variables? (I use Stata 7)?

>>> I fear that the answer does involve something like
a  -reshape-.

A user-written program -tabm- does do this,
but internally it uses -stack-. It probably will
be slow in your circumstances, but it will leave
your data as is.

-tabm- is part of the -tab_chi- package on SSC.

There is a more general FAQ on multiple responses
of this kind by Ulrich Kohler and myself at

http://www.stata.com/support/faqs/data/multresp.html

and the same material, updated a bit, is covered
in Stata Journal 3(1), 2003.

In short, we know of no magic fix for multiple
responses, although we bundled together tips
and tricks we know about.

Nick
[email protected]

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