Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Price Index


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Price Index
Date   Tue, 5 Apr 2011 18:26:40 +0100

Let me outline solutions for two situations. 

1. Suppose you have a single item whose price you are monitoring. 

Then 

su price if time == 495

gen priceindex = 100 * price / r(mean) 

I am clearly assuming that you want 100 as your base. 

2. However, I imagine you would not be asking if that was the problem. Your question implies something like a panel structure. 

Then you could reach for something more like 

egen priceindex = total(price / (time == 495)), by(panelid) 

or 

egen priceindex = total(price * (time == 495)), by(panelid)

followed by 

replace priceindex = 100 * price / priceindex 

The logic is that -time- of 495 occurs just once in each panel. You should check that. 

You could squeeze that into one command, no doubt, but I guess with some loss of clarity. 

Nick 
[email protected] 

A.Silva

I need to create a price index using a base price.
How can I indicate to Stata to use always the same observation as a base (in my example time==495)?
For example, my variables are:
time price
495 20
496 22
497 23


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index