Quick Table for Renaming Variables in Stata

Renaming a single variable is pretty simple in Stata. Assume that we have the following variables in our data set.

date symbol returns

If we wish to rename the variable ‘ returns’ as ret , then the code will be as follows”

rename returns ret

Renaming many variables

We can rename many variables using the “rename group” features of the rename command. So, if we wish to rename all the three variables together, our code will be

rename (date symbol returns) (Date Symbol Returns)

In the above code, we just renamed date to Date, symbol to Symbol, and returns to Returns. From this example, we also learned that Stata’s variables are case sensitive. See the following table for more examples using parentheses.