Why not just use "egen"?
bys country good: egen ave_price=mean(price)
dave
------------------------------------------------------------------------
PhD student, Harvard Economics Department
Phone: (O) 617-495-5634, (H) 617 - 493 - 1536
Address: Currier Mail Center #554, Cambridge, MA 02138
------------------------------------------------------------------------
On Fri, 10 Dec 2004 [email protected] wrote:
>
> Dear all,
>
> I am looking for the easiest way to compute averages per good per country.
> My a dataset looks about the following:
>
> Article 1 US 10
> Article 1 FR 15
> Article 1 FR 20
> Article 1 UK 10
> Article 1 UK 18
> �
> Article 2 US 10
> Article 2 US 15
> Article 2 UK 20
> Article 2 UK 10
> ...
>
> In other words, I have prices for different goods, originating from
> different countries. I am interested in the average price for each of the
> goods per country, i.e. the average price charged for article 1 in the US,
> the average for article 1 in France, in the UK; similarly for article 2
> etc. A complication is that for a number of goods I only have observations
> for a subset of countries, and the number of observations varies good and
> country (e.g. for article 1 I have, say, 5 observations from Greece, but
> none from Italy, whereas for good 3 I have ten observations from Italy, but
> none from the US or France).
>
> So far I've only been able to come up with relatively clumsy solutions, so
> help is greatly appreciated,
>
> Philipp
>
>
>
> --
> _____________________________________________________________________
> Zon Gratis ADSL. De voordelen van gratis internet met de snelheid van
> ADSL. Zonder abonnementskosten en zonder vast contract. Je betaalt
> alleen voor de tijd online. Nu zonder aansluitkosten en met gratis
> modem. Bestel snel op zonnet.nl.
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/