I have a dataset where every variable name is a long string (basically the first 32 characters of the associated survey question). I have a corresponding list of simplified variable names that are, importantly, in the same order. I want to rename all variables to their associated name in the simplified list.
The long way to do this in stata is:
rename longstring1 simplifiedname1
rename longstring2 simplifiedname2
.... and so on
In the past, I have avoided this by importing the dataset to excel, and simply replacing the first row with the simplified names by copying and pasting that row from an excel sheet where I have the simplified names stored. Then I just save that excel sheet and import that into stata.
Is there a way that I can do this process in stata without renaming every variable one by one?
The long way to do this in stata is:
rename longstring1 simplifiedname1
rename longstring2 simplifiedname2
.... and so on
In the past, I have avoided this by importing the dataset to excel, and simply replacing the first row with the simplified names by copying and pasting that row from an excel sheet where I have the simplified names stored. Then I just save that excel sheet and import that into stata.
Is there a way that I can do this process in stata without renaming every variable one by one?

Comment