Hi,
I have 516 variables named as m229 to m744.
I want to rename each one of them so that m229 becomes m1, m230 becomes m2, ..., m744 becomes m516.
In a way, I want to subtract the 228 from the number given in the name of the each of the variable.
Hence I tried using the following loop:
The loop ran and didn't show any error but no change in the name of the variables.
I am showing the sample output for your reference.
Thanks in advance.
I have 516 variables named as m229 to m744.
I want to rename each one of them so that m229 becomes m1, m230 becomes m2, ..., m744 becomes m516.
In a way, I want to subtract the 228 from the number given in the name of the each of the variable.
Hence I tried using the following loop:
forval i = 229(1)744 {
rename m`i' m`i-228'
}
rename m`i' m`i-228'
}
I am showing the sample output for your reference.
. forval i = 229(1)230 {
2. ren m`i' m`i-228'
3. }
(all newnames==oldnames)
(all newnames==oldnames)
2. ren m`i' m`i-228'
3. }
(all newnames==oldnames)
(all newnames==oldnames)
Thanks in advance.
Comment