// 设置文件夹路径
local folder_path = "C:\Users\13188\Desktop\论文杂\数据\工企GVC计算代码及其产生的文件和数据"
local save_path = "C:\Users\13188\Desktop\论文杂\数据\工企GVC计算代码及其产生的文件和数据"
// 设置合并后的文件名和保存路径
local merged_file = "被解释变量面板.dta"
// 创建一个空数据集用于存储合并后的数据
clear
// 循环遍历不同年份的文件夹
local i =2000
while `i' <=2014 {
// 构建当前文件的完整路径
local current_file = "`folder_path'/`i'/终结果(未考虑中间品和贸易商问题).dta"
// 检查当前文件是否存在
capture confirm file "`current_file'"
if _rc == 0 { // 如果文件存在
// 导入当前文件
use "`current_file'", clear
// 添加年份变量
gen year = `i'
// 将当前文件追加到合并后的数据集中
append using "`merged_file'"
}
local i = `i' + 1
}
// 保存合并后的数据集
save "`save_path'/`merged_file'", replace
no variables defined
r(111);
这是为什么?


雷达卡

京公网安备 11010802022788号







