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 10:42:00 -0400 |

gen meancatch = TABLE[zone,wave] and gen meancatch = TABLE[byv,num_typ3]

I'd appreciate any tips. Sergio On Thu, 1 Sep 2011 15:49:50 -0400, Austin Nichols wrote:

Sergio <sergioal@ufl.edu>: Try (-tabstatmat- is on SSC): egen byv=group(zone wave), lab tabstat num_typ3, stat(mean) by(byv) save tabstatmat TABLEOn Thu, Sep 1, 2011 at 3:30 PM, Alvarez,Sergio <sergioal@ufl.edu>wrote:Dear Statalisters,I'm trying to create a matrix of the grouped means of a variable(num_typ3).The observations in my dataset are grouped by location (zone) andtimeperiod (wave).Ideally the matrix would have the zones as the rows and the waves asthecolumns (or vice-versa), something like this: WAVE ZONE 1 2 ... 1 mean(1,1) mean(1,2) 2 mean(2,1) mean(2,2) ...I would use the matrix to generate a variable that takes the meanvaluedepending on the zone and wave, using something like: gen meancatch = TABLE[zone,wave] I believe I need to go this route, rather than directly creating thevariable, because I'm creating a set of 'fake' alternatives for each'real'observation, corresponding to each location. Each observationcorrespondsto a fishing trip, so the alternatives are the possible fishingtrips thatdidn't happen. I'll do that using -reshape-. Anyway, I thought -tabstatmat- would do the job, so I tried: by zone wave, sort: tabstat num_typ3, stat(mean) saveWhich gives me the elements of the ideal matrix one by one. Then Itry:tabstatmat TABLE But this returns a 1x1 matrix: symmetric table[1,1] num_typ3 mean .94892632So my question is, where did I mess up? Or did I justmisunderstand what-tabstatmat- does? Is there a convenient way to do this? Thanks in advance, Sergio* * 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>

- Prev by Date:
**Re: st: Package -ghansen- now available in SSC** - Next by Date:
**RE: st: Package -ghansen- now available in SSC** - Previous by thread:
**Re: st: tabstatmat question** - Next by thread:
**Re: st: tabstatmat question** - Index(es):