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: Program for collecting the totals from tabm


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Program for collecting the totals from tabm
Date   Wed, 18 May 2011 07:51:51 +0100

I don't know why I said -collapse-. "Totals" here mean categorical
frequencies. Another way is illustrated by

clear
set obs 100
set seed 2803
forval j = 1/10 {
	gen y`j' = ceil(6 * runiform()^`j')
}
tabm y*
gen id = _n
reshape long y , i(id)
contract y
list

2011/5/18 Nick Cox <[email protected]>:
> Thanks on behalf of all user-programmers for the thanks. -tabm- is
> part of -tab_chi- from SSC. Please remember the Statalist request to
> explain _where_ user-written programs you refer to come from.
>
> -tabm- lets you reach through to -tabulate-'s options, so using
> -replace- will give you a dataset that is what -tabm- works with
> (temporarily).
>
> But aren't you better off just with -collapse (sum)- followed by
> something equally simple?
>
> Nick
>
> On Wed, May 18, 2011 at 12:12 AM, Daniel Chandler
> <[email protected]> wrote:
>
>> As a preface I would like to express my gratitude for tabm and the many
>> other user-written programs I use all the time (statplot being the most
>> recent).
>>
>> Using tabm I can summarize a number of comparable variables, in this case
>> a Likert scale going from 1-6:
>>
>>
>> . tabm iu1staff- iu5staffrev, nofreq row valuelabel(response)
>>
>>                     |                              values
>>            variable             |        SD    MD    D   A      MA    SA
>> |     Total
>> ----------------------+----------------------------------------------------
>> --------------+----------
>> Staff accepts me for |      2.01       3.02       3.02      11.06
>> 34.17      46.73 |    100.00
>> Staff is interested     |      9.55      12.56      13.07      26.13
>> 25.13      13.57|    100.00
>> Staff respects my sp |      3.57       1.02       1.02      11.22
>> 27.55      55.61 |    100.00
>> Staff appreciates my |      1.50       2.50       3.00      17.50
>> 35.50      40.00 |    100.00
>> Staff doesnšt really    |      3.48       7.46       9.45      13.43
>> 30.85      35.32 |    100.00
>> ----------------------+----------------------------------------------------
>> --------------+----------
>>               Total                |      4.02       5.33       5.93
>> 15.88      30.65      38.19 |    100.00
>>
>>
>> I have 75 variables that I would like to get the "Totals" for (in groups
>> of 5 as above). I would like the totals to be contracted into a table or
>> dataset with 15 rows corresponding to the 15 totals rows.
>>
>> Here is an example done manually (with percentages converted to
>> fractions--which is not a necessary part of what I need):
>>
>>                         SD     MD     D      A      MA    SA
>> Individual Uniqueness 0.0392      0.0653      0.0933     0.1604     0.319
>>  0.3228
>> Non-judgmentalism     0.0444      0.1463    0.1556      0.1778     0.2241
>> 0.2519
>> Motivation            0.0241      0.0352     0.037       0.1204     0.3593
>>  0.4241
>> Power                 0.0243       0.0578     0.069     0.1623      0.3489
>>  0.3377
>> Respect               0.0241     0.0463     0.0556     0.1481     0.3148
>> 0.4111
>>
>>
>> I have not been able to figure out how to do this except manually, which
>> won't work as this is to be part of a program run recurrently.
>>
>

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