Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Alvarez,Sergio" <sergioal@ufl.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: tabstatmat question |

Date |
Fri, 02 Sep 2011 12:35:09 -0400 |

Sorry about ambiguity.

egen byv=group(zone wave), lab tabstat num_typ3, stat(mean) by(byv) save tabstatmat TABLE

TABLE[414,1] num_typ3 1†1:mean 1.9822335 1†2:mean 2.6614173 1†3:mean 2.7150396 1†4:mean 3.3340782 1†5:mean 2.8161094 1†6:mean 1.1767857 2†1:mean 1.5857143 2†2:mean 2.1863208 2†3:mean 2.542777 2†4:mean 1.8849432

gen meancatch = TABLE[zone,wave]

gen meancatch = TABLE[byv,num_typ3]

Thanks again, Sergio On Fri, 2 Sep 2011 12:08:31 -0400, Austin Nichols wrote:

Sergio <sergioal@ufl.edu> : Now I have no idea what you are trying to do. For the mean by group, egen mby=mean(num_typ3), by(zone wave)but you are referring to (probably) nonexistent row and columnnumbersof a matrix in your example.On Fri, Sep 2, 2011 at 10:42 AM, Alvarez,Sergio <sergioal@ufl.edu>wrote:Thanks Austin and Nick for your help. I used what Austin suggested(whichis what Nick also suggested) and it worked. However, when I try tocreatethe variable that contains the mean by group it works for someobservations,but missing values are created for most of them. I tried both: gen meancatch = TABLE[zone,wave] and gen meancatch = TABLE[byv,num_typ3] For the first line of code, it creates the correct value for allobservations where wave = 1, but not for any others. The secondlinecreates missing values at random (as far as I can tell). I'd appreciate any tips.* * 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/

-- Sergio Alvarez Food and Resource Economics University of Florida * * 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/

**Follow-Ups**:**Re: st: tabstatmat question***From:*Austin Nichols <austinnichols@gmail.com>

**References**:**st: tabstatmat question***From:*"Alvarez,Sergio" <sergioal@ufl.edu>

**Re: st: tabstatmat question***From:*Austin Nichols <austinnichols@gmail.com>

**Re: st: tabstatmat question***From:*"Alvarez,Sergio" <sergioal@ufl.edu>

**Re: st: tabstatmat question***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**Re: st: tabstatmat question** - Next by Date:
**Re: st: Asking: choose between collapse and sort,copy-paste** - Previous by thread:
**Re: st: tabstatmat question** - Next by thread:
**Re: st: tabstatmat question** - Index(es):