Bookmark and Share

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


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

RE: st: AW: summary table after tab1


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: summary table after tab1
Date   Mon, 28 Jun 2010 19:24:34 +0100

This question also came up just a few weeks ago. See e.g. 

http://www.stata.com/statalist/archive/2010-06/msg00027.html

-tabm- from -tab_chi- on SSC is aimed directly at this problem. No need to code it yourself. 

Nick 
[email protected] 

Andrzej Niemierko

That's exactly what I needed: -stack- while -preserve-ing.
Thank you, Martin.


On 6/27/10 4:05 PM, "Martin Weiss" <[email protected]> wrote:


> -stack- the vars while -preserve-ing:
> 
> ***********
> clear*
> 
> input byte var1  var2 var3
> 1        4        2
> 3        1        6
> 6        1        5
> 2        3        4
> 6        4        5
> end
> 
> preserve
>  stack var?, into(myvar) clear
>  ta myvar
> restore
> 
> ***********
> 
> 
> HTH
> Martin
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Andrzej Niemierko
> Sent: Sonntag, 27. Juni 2010 21:45
> To: Stata
> Subject: Re: st: AW: summary table after tab1
> 
> Thank you Martin and Don. Unfortunately, that's not what I need.
> Let's say I have three variables var1-var3 and they contain integer numbers
> between 1 and 6, e.g.:
> 
> var1    var2    var3
> 1        4        2
> 3        1        6
> 6        1        5
> 2        3        4
> 6        4        5
> 
> -tab1 var*- gives me three tables of frequencies for each variable
> separately. I need just one table that tells me the overall number of 1's,
> 2's, 3's etc.
> Andrzej
> 
> 
> 
> 
> On 6/27/10 1:13 PM, "Martin Weiss" <[email protected]> wrote:
> 
>> 
>> <> 
>> 
>> You may want to use -egen, group()- beforehand:
>> 
>> 
>> *************
>> sysuse auto, clear
>> tab1 turn trunk, sort
>> egen mygroups=group(turn trunk), label
>> ta mygroups
>> *************
>> 
>> 
>> 
>> HTH
>> Martin
>> 
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Andrzej
>> Niemierko
>> Gesendet: Sonntag, 27. Juni 2010 18:13
>> An: Stata
>> Betreff: st: summary table after tab1
>> 
>> What's the simples way to generate a one-way summary table of frequencies
>> over several variables. -tab1 varlist, sort- generates individual tables
> but
>> I need a single table with frequencies summed over varlist.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index