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: tabulation question


From   Nikolaos Pandis <[email protected]>
To   [email protected]
Subject   Re: st: tabulation question
Date   Mon, 4 Nov 2013 23:35:31 +0200

Sergiy,

Thank you for the explanation.
I used "tabulate" and it worked out great.
I have 30 variables but all have 3 levels-so no problem there and I
can do a little editing
A 'transpose" option would have been great.
I tried to use "tabout" but the % did not work-this would have been
ideal as the table formatting would have been almost done!

see what I get with tabout-but perhaps I am using it incorrectly

..your previous code...
foreach myvar of varlist justificationforthetrial-literaturereview {
tabulate `t' `myvar' , row
tabout `t' `myvar'  using file.xls if rct==1,cells( fre row) f(0c)
clab(No. %) append
}

Statistic 1 1 2 2 3 3 Total Total
No. % No. % No. % No. %
Freq 15 100 16 100 116 100 147 100
Total 15 100 16 100 116 100 147 100
Best wishes,
Nick

On Mon, Nov 4, 2013 at 11:15 PM, Sergiy Radyakin <[email protected]> wrote:
> 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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index