# st: Re: efficient way to construct prices

 From "Michael Blasnik" To Subject st: Re: efficient way to construct prices Date Mon, 28 Jul 2003 16:01:04 -0400

```This type of calculation is very easy in Stata....If you want the average
price for each good and each region and you define the average as the
average selling price per unit (as opposed to the average selling price per
transaction), then:

egen valuetot=sum(value),by(good region)
egen volumetot=sum(volume),by(good region)
gen avgprice=valuetot/volumetot

on the other hand, if you want the average selling price per transaction,
then:
gen price=value/volume
egen avgprice=mean(price),by(good region)

Michael Blasnik
michael.blasnik@verizon.net

----- Original Message -----
From: "Alexand Shepotilo" <shepotil@econ.bsos.umd.edu>
To: <statalist@hsphsun2.harvard.edu>; <sdriver@stata.com>
Sent: Monday, July 28, 2003 2:48 PM
Subject: st: efficient way to construct prices

> Dear Statalist,
>
>       I have data on household expenditures. Each datapoint tells about
> volume and value of product k that household i from region j has bought.
> I can get information on price of each transaction as price =
> value/volume.
>      I also have data on volume of home production of good k by HH i in
> region j. Now, the problem is to calculate value of home production. I
> need to construct average price of good k in region j. Can you suggest
> how to generate average price? It has to be programmed since I have 100
> products and 90 regions.
>
> Oleksandr.
>

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