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: tabulation question
From
Sergiy Radyakin <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: tabulation question
Date
Mon, 4 Nov 2013 16:15:03 -0500
Nick,
you can get a bunch of different stats with -table-, but not
proportions, so try -tabulate- instead of table in the last code line
of the above example:
tabulate `t' rep78, row
I don't know an easy way to get rid of the totals in this table using
just options. Also interestingly, the svy version of this command
resists such an alignment, and rotates itself when there is only one
row into a column. Totally not sure what is the motivation for
implementing this behavior, and not having a simple -transposed-
option.
-tabulate- is built-in, so no way to cut into the middle.
Some 6 years ago I wrote a totally custom solution for doing all sort
of things like this, but it is plugin-based and Windows-specific, so
not sure if it is going to be welcomed. For your case a couple of
simple loops would suffice (loop by vars you want, by their levels,
summarize if, divide r(N) by _N to get proportions), so there is
probably no reason to bring in heavy artillery.
I am not sure what you mean with a loop for several variables - they
might have different number of categories, so be careful, as you would
need to stitch/align the results.
Best, Sergiy Radyakin
On Mon, Nov 4, 2013 at 3:48 PM, Nikolaos Pandis <[email protected]> wrote:
> Sergiy
>
> Thanks! It looks great
> I added a loop to do this for several variables.
> How can I add the % of the row total next to the frequencies?
>
> Best,
>
> Nick
>
> On Mon, Nov 4, 2013 at 10:18 PM, Sergiy Radyakin <[email protected]> wrote:
>> Yes, Nick:
>> do http://radyakin.org/statalist/2013110401/horiz_freq.do
>> perhaps there are multiple other ways to do it.
>>
>> Best, Sergiy Radyakin
>>
>> On Mon, Nov 4, 2013 at 2:42 PM, Nikolaos Pandis <[email protected]> wrote:
>>> Hi,
>>>
>>> Is there a way to put the levels of the categorical variable (1-3)
>>> into the columns and the frequencies in the rows?
>>> Thank you,
>>> Nick
>>> tabulate catvar
>>> catvar |
>>> |
>>> | Freq. Percent Cum.
>>> ------------+-----------------------------------
>>> 1 | 15 10.20 10.20
>>> 2 | 16 10.88 21.09
>>> 3 | 116 78.91 100.00
>>> ------------+-----------------------------------
>>> Total | 147 100.00
>>> *
>>> * For searches and help try:
>>> * http://www.stata.com/help.cgi?search
>>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>>> * http://www.ats.ucla.edu/stat/stata/
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>> * http://www.ats.ucla.edu/stat/stata/
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/