From the data below, you can see that i have the inflation for a few years. However, this came from some data that went far behind 2007. So I want to create an inflation series that starts at year 1.
Then I want to create the real_cmat dividing c_mat / inflation.
I started by trying to use this
gen index = 1
replace index = index[_n-1] * (1 + inflation) if _n > 1, but this gives me a accumulative and its not the inflation.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 Country_Code int year str52 Country_Name double inflation str9 c_mat "ITA" 2007 "Italy" 1.829741122024 "615945" "ITA" 2008 "Italy" 3.34783258401023 "579282" "ITA" 2009 "Italy" .774768131387384 "478557" "ITA" 2010 "Italy" 1.52551602118248 "540085" "ITA" 2011 "Italy" 2.78063272879324 "513460" "ITA" 2012 "Italy" 3.04136333226773 "432065" "ITA" 2013 "Italy" 1.21999342274305 "396066" "ITA" 2014 "Italy" .241047429826773 "425068" "ITA" 2015 "Italy" .0387903996579552 "357058" "ITA" 2016 "Italy" -.0940166569157271 "372849" "ITA" 2017 "Italy" 1.22653316645808 "" end
0 Response to Creating an inflation index series
Post a Comment