Dear All,

I am working with a dataset that looks like this:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long area_code int year float median_price
1 1995  40937.73
1 1996  39861.69
1 1997  39733.54
1 1998  40663.02
2 1995  40847.36
2 1996  41003.74
2 1997  42096.74
2 1998  41693.68
2 1999  43277.97
3 2003  71433.79
3 2004  97739.76
3 2005 110520.58
3 2006 119008.65
3 2007 129272.96
3 2008 127305.28
3 2009 116836.67
3 2010 120656.55
4 2017 133330.81
4 2018 135226.48
4 2019 135258.63
end
The panel has the following characteristics:

Code:
 panel variable:  area_code (unbalanced)
        time variable:  year, 1968 to 2019
                delta:  1 unit
I am trying to generate new variables to represent the percentage change (either literally as a percentage change or as a difference of logs) using different baseline years by area.
More precisely, I would like to generate:
-Percentage change in median_price with 1999 as baseline for each subsequent year by area_code
-Percentage change in median_price with 2002 as baseline for each subsequent year by area_code
-Percentage change in median_price with 2008 as baseline for each subsequent year by area_code

After

Code:
xtset area_code year
I tried using D.median_price and L.median_price, but I am not able to set different baseline years.


I would be very grateful if you could help me on this.

Kind regards,
Giovanni