Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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,
gen price=value/volume
egen avgprice=mean(price),by(good region)

Michael Blasnik

----- Original Message ----- 
From: "Alexand Shepotilo" <>
To: <>; <>
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:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index