Syntax
reindex varname, generate(name) [i(name)] j(name) from(string) to(string) [fromscale(integer 1)] [toscale(integer 1)] [tobase(integer -999)]
varname is the name of the variable you want to manipulate
Options
generate() Required: give a name for the new variable.
i() Set the panel id variable if there are panels. You can use just one variable and it needs to be numeric. Pretty much like xtset. If there is no panel id, you can leave it out.
j() Required: time variable. Intervals must always be the same.
from() Required: choose between levels, percent, factor, and index
to() Required: choose between percent, factor, and index. You can't go back to levels.
fromscale() In case your variable was multiplied by some factor (say 100 for percentages or an index).
toscale() Same for the target variable.
tobase() Set the base time period (required with the option to(index))
Working example
This command will convert gdp growth figures from factors (1.02 for 2 percent growth) to and index with base 2000 = 100.
reindex gdp_growth, generate(gdp_index2000) from(factor) to(index) tobase(2000) scale(100)) i(country) j(year)
Install
Download the following file: reindex.ado and put it in your personal ado folder (on Windows this is generally C:\ado\personal\). Put it in the subfolder r\. Stata will now search this directory for programs and have the command ready when you call it.Please, after a few weeks of using the program, send me a mail with your remarks in order to improve the code and help out bugs. My address is in the ado file.