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

RE: st: geometric mean with foreach


From   "U.A.QU.AP" <[email protected]>
To   [email protected]
Subject   RE: st: geometric mean with foreach
Date   Tue, 13 Dec 2005 10:56:15 +0100 (CET)

You will need to get the -egenmore- package from ssc, use -
reshape- to make a single variable
representing price, make a variable telling you the year 
(since it appears you have monthly data and you want yearly 
means), 
than using -egen geomprice = gmean(price), by(year)- to get 
the
variable you want. 

with your solution it is difficult to create variable year
the new form of my data is:
			price1		price2
period:801		100    		100
period:802		100.3		100.7
.
.
.
period:032		127			130
given this structure what is the bes way to create a gometric 
mean
for periods 801 to 8012; 802 to 811 and so on
note that period 801 denotes price at january 1980
Best
Abdelrahmen


---- Original message ---- 
>Date: Mon, 12 Dec 2005 20:22:17 +0000 (GMT)
>From: Maarten buis <[email protected]>  
>Subject: RE: st: geometric mean with foreach  
>To: [email protected]
>
>AbdelRahmen:
>
>You will need to get the -egenmore- package from ssc, use -
reshape- to make a single variable
>representing price, make a variable telling you the year 
(since it appears you have monthly data
>and you want yearly means), than using -egen geomprice = 
gmean(price), by(year)- to get the
>variable you want. 
>
>HTH,
>Maarten
>
>-----------------------------------------
>Maarten L. Buis
>Department of Social Research Methodology
>Vrije Universiteit Amsterdam
>Boelelaan 1081
>1081 HV Amsterdam
>The Netherlands
>
>visiting adress:
>Buitenveldertselaan 3 (Metropolitan), room Z214
>
>+31 20 5986715
>
>http://home.fsw.vu.nl/m.buis/
>-----------------------------------------
>
>> I have monthly price data in the follwing form
>>
>>                 p801    p802............p036
>> 
>> good1           100     100.3...........
>> good2           100     100.5...........
>> .
>> .
>> goodn          100      100.6..........
>> 
>> p801 denotes price at january 1980
>> I want to construct a geometric mean of monthly prices for
>> each possible year
>> say price index for year going from january 80 to december 
80
>> and feb 80 to january 81
>> .... to may 2002 to june 2003
>
>
>
>		
>___________________________________________________________ 
>NEW Yahoo! Cars - sell your car and browse thousands of new 
and used cars online! http://uk.cars.yahoo.com/
>*
>*   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/



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