Dear all,
I have a data set which contains many variables e.g. with a country prefix: "mexiko_variablename", I would like to rename this variable without the name of the country in front of it.
the normal way would just be
rename mexiko_variablename variablename
However, I have plenty of those variables and I would like to do it with a loop. Can someone tell me how this loop would look like?
Many thanks in advance
Related Posts with rename variables with foreach (getting rid of prefix)
Selecting dates within groups based on specific criteria in order to create a more unique idHello all, I'm a new Stata user and new to Statalist; I'm currently using StataMP 14. I'm doing so…
Create new variable of survey dataHello. I'm working with survey data from the Eurobarometer survey. I want to create a new variable, …
Problem with reshape wide to longHi everyone, I have a dataset with 219 variables which I would like to reshape from wide to long. 9…
Loop with consecutive numbersHello Stata community, I am trying to replace multiple id of a data set, where the ids are consecut…
Selecting all dates within groups that are within one week of each other and creating a sub-group idHello all, I'm a new Stata user and new to Statalist; I'm currently using StataMP 14. Purpose: I'm…
Subscribe to:
Post Comments (Atom)
0 Response to rename variables with foreach (getting rid of prefix)
Post a Comment