I'm stuck trying to do a loop to read many files that have no correlated names, but I want to save them with correlated names.
This is an example of what I have:
paths:
"example_84745.dta"
"example_74632.dta"
"example_18390.dta"
So, I want to read all of them and save them like
"example_1.dta"
"example_2.dta"
"example_3.dta"
What I'm trying to do is to work with local macros, like this:
local path_1 = "example_84745.dta"
local path_2 = "example_74632.dta"
local path_3 = "example_18390.dta"
forvalues i = 1(1)3{
display "path_`i'"
use "path_`i'", clear
save "example_`i'"
}
But it is not working. It prints path_1 is not found.
I really appreciate your comments.