Hi All,
I'm using the following code to loop over files in a folder to sort two variables, Destination and Country:
I checked the macro, the local looks like:
The above code ran smoothly, but when I check the datasets, the two variables are still not sorted, it seems the loop code did not work. I can't figure out why. I'm wondering where I did wrong.
Any help is appreciated!
Many thanks,
Craig
I'm using the following code to loop over files in a folder to sort two variables, Destination and Country:
Code:
local files: dir "${table}/Destination_same country" files "*.dta" foreach file of local files { use `"`file'"' , clear sort Destination Country save `"`file'"', replace }
Code:
. macro list _files: "Destination_same country_1.dta" "Destination_same country_3.dta" "Destination_same country_2.dta" "Destination_same country_4.dta"
Any help is appreciated!
Many thanks,
Craig
Comment