Hello Everyone.
I need help in combining local macro with global path.
This is my code for combining CSV files in Stata
cd "D:\data"
local files: dir "D:\data" files "*.csv"
foreach file in `files'{
clear
import delimited `file'
save `file'.dta, replace
}
local files: dir "D:\data" files "*.dta"
foreach file in `files'{
append using `file', force
}
save master, replace
My global path is for Microsoft OneDrive is
global mainpath `"C:/Users/Admin/OneDrive/data"'
I tried multiple ways to combine this path with the existing code.
But the code is not able to fetch the CSV files stored in the “data” folder.
Can anyone guide me regarding it?
Thanks, and regards
I need help in combining local macro with global path.
This is my code for combining CSV files in Stata
cd "D:\data"
local files: dir "D:\data" files "*.csv"
foreach file in `files'{
clear
import delimited `file'
save `file'.dta, replace
}
local files: dir "D:\data" files "*.dta"
foreach file in `files'{
append using `file', force
}
save master, replace
My global path is for Microsoft OneDrive is
global mainpath `"C:/Users/Admin/OneDrive/data"'
I tried multiple ways to combine this path with the existing code.
But the code is not able to fetch the CSV files stored in the “data” folder.
Can anyone guide me regarding it?
Thanks, and regards
Comment