Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: Combining Frequency Tables

 From "Nick Cox" To Subject RE: st: Combining Frequency Tables Date Tue, 1 Jun 2010 18:50:40 +0100

```This makes a lot of sense to me, because the need for it used to bite me a lot.

As Austin implies, you need to -reshape- (or -stack-) to get official Stata commands to work here. That's the bad news. But -tabm- (in the package on SSC -tab_chi-) does it for you. That's the good news. Use -ssc inst tab_chi- to download.

Stata 7 is required.

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

Austin Nichols

Oren Jalon <oren@mentor-initiative.net>:
Doesn't make a lot of sense to me, but try e.g.:

preserve
ren varX fake1
ren varY fake2
g long i=_n
keep i fake1 fake2
reshape long fake, i(i) j(j)
tab fake j
tab fake
restore

On Tue, Jun 1, 2010 at 10:09 AM, Oren Jalon <oren@mentor-initiative.net> wrote:

> Not quite.  For example, if Var X has 100 records and Var Y has 200 records
> where Var X has #6 twenty times and and  Var Y has #6 ten times, the
> frequency of the variable would be:
>
> (20+10) /(100+200) = 30/300 or 0.1
>
> I guess 'table' is the wrong term.  I need the combined frequency of two
> variables.  Does this make sense?

On 6/1/2010 3:00 PM, Maarten buis wrote:

>> --- Oren Jalon wrote:
>>
>>>
>>> I have two variables (Var X and Var Y) which both have values ranging
>>> from 1 to 9.  I can tabulate the frequency of values from each variable
>>> individually but is there a way to combine all the values and get a
>>> combined frequency table?
>>>
>>
>> -tab x y- will give you a cross tabulation, which is I suppose what
>> you mean with a "combined frequency table". For more see: -help tab2-.

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