当我重新运行 STATA 脚本时,硬链接未更新

当我重新运行 STATA 脚本时,硬链接未更新

我已经在一个 STATA 脚本的输出文件和下一个脚本的输入文件之间创建了硬链接和符号链接。我希望当我运行第一个脚本并且输出文件更新时,目标文件也会按预期使用硬链接进行更新。但是,目标文件从不更新。我最初将文件夹放在 dropbox 下,我认为这可能是问题所在,因此我将它们移动到本地系统,但这并没有帮助。我读到过,某些程序可能会通过删除旧版本并保存新版本来保存文件更新,这可能会破坏链接。我不确定 STATA 是否也是如此。有人知道如何让符号链接工作吗?这是我为创建硬链接而运行的命令

C:\Users\[File Path]\Tasks_EMOP>mklink /H "C:\Users\[Path]\Consumption_By_Season_Cleaning\Input\emop_despenses_2011_2019_cl.dta" "C:\Users\[File Path]\Appending_Raw_Datasets\Output\emop_despenses_2011_2019_cl.dta"

这是保存到输入文件的脚本

* Geographical info
rename Region, lower
label var region "Region"
label define REGION 8 "Kidal", modify
rename Cercle circle 
label var circle "Cirlce" // What's this?
rename Arrond borough
label var borough "Borough"
rename Commune town
label var town "Town"
rename Milieu urban
recode urban (2=0)
label def MILIEU 0 "Rural", modify
label var urban "Urban or rural"

egen tot_exp = rowtotal(consom_total_s1 consom_total_s2 consom_total_s3 consom_total_s4), missing 
label var tot_exp "Total HH expenditure (CFA)"
 
*keep hhid year cluster region circle borough town urban tot_exp taille_men

* For 2014 and 2016 ciricle, borough, and town are completely missing
preserve
use "$input/emop_indivitus_2011_2019_cl.dta", clear
keep iid hhid year region circle borough town
collapse (firstnm)  region circle borough town, by(hhid year)
keep if year == 2011 | year == 2013 | year == 2014 | year == 2016
tempfile geo_vars
save `geo_vars'
restore

merge 1:1 hhid year using `geo_vars', update replace
drop _merge

* For R users
gen region_id = region
gen circle_id = circle 
gen borough_id =  borough
gen town_id = town

* Check duplicates
duplicates report hhid cluster region circle borough town year // None
rename hhid idmenage

save "$output/emop_despenses_2011_2019_cl.dta", replace
// save "C:\[filepath]\Tasks_EMOP\Consumption_By_Season_Cleaning\Input\emop_despenses_2011_2019_cl.dta", replace


原始文件位置的屏幕截图 https://i.stack.imgur.com/6lGxe.png

目标文件位置截图

https://i.stack.imgur.com/0v1bL.png

相关内容