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]

st: RE: Trouble with fsum


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Trouble with fsum
Date   Thu, 31 Mar 2011 19:40:37 +0100

The latest version is 2005, so nothing has changed recently. 

I think your trouble is one of misunderstanding. 

-fsum- with -cat()- does not produce a breakdown by the argument of -cat()-. It instructs -fsum- to treat one or more of the variables specified as categorical. If the argument of -cat()- is not also a variable in the main variable list, then it is ignored. 

Compare

. fsum mpg, cat(rep78)

 Variable |        N     Mean       SD      Min      Max                                                                                                                              
----------+---------------------------------------------
      mpg |       74    21.30     5.79    12.00    41.00  

(-rep78- ignored) 

with 

. fsum mpg rep78, cat(rep78)

 Variable |        N     Mean       SD      Min      Max                                                                                                                              
----------+---------------------------------------------
      mpg |       74    21.30     5.79    12.00    41.00  
    rep78 |       69     3.41     0.99     1.00     5.00  
   1 (%)  |        2     2.90
   2 (%)  |        8    11.59
   3 (%)  |       30    43.48
   4 (%)  |       18    26.09
   5 (%)  |       11    15.94

(-mpg- summarized as numeric; -rep78- summarized as numeric, and tabulated as categorical.) 

I think you want something more like -tabstat-. 

Nick 
[email protected] 

Ishir Bhan

I just grabbed the latest version of fsum from ssc, but it doesn't
seem to be working properly for me. I believe I've used it before
successfully on a different install.

I have a continuous variable, age, and a binary variable male. I want
to summarize age by sex, so I do:

fsum age, cat(male)

But the categorization doesn't work. I just get a single summary line for age.

I've tried this with other variables in case something was strange
about one of these variables, but no luck. Is there an issue with the
version currently on ssc? Or am I just doing something wrong?


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