I have a lot of datasets named 1.dta, 2.dta, 3.dta...40.dta. My goal is to rename each by the values of a variable 'countryCode' so that I know which country the dataset is for.
Here is my wilde guess, but it's not working:
Please let me know if there is a way to perform this.
Thanks in advance!
Here is my wilde guess, but it's not working:
Code:
forvalues i = 1/20 { use `i'.dta, clear local country = v000 rename `i'.dta `country'.dta clear `i'.dta }
Thanks in advance!
Comment