2
我想知道是否可以自动保存.do文件,以便它包含与我在.do文件内创建的日志文件上的时间戳匹配的时间戳。例如,我开始每。做文件我得看起来像这样:Stata:每次在do文件编辑器中执行.do文件时,是否可以使用时间戳自动保存.do文件?
#delimit ;
capture log close;
display _n(250);
*******Sets up the log for the output;
local a1=substr(c(current_time),1,2);
local a2=substr(c(current_time),4,2);
local a3=substr(c(current_time),7,2);
local b = c(current_date);
log using "H:\HSRE\Hospice Payment Reform\Plotzke\Ad Hoc Tasks\OY1\Monitoring for macs\Log\BPA Log (`b')`a1'_`a2'_`a3'", t;
<rest of the program>
display "Start: `starttime'";
display "End: " "$S_TIME";
log close;
有什么我可以在节目的最后添加将保存我只是跑了。做文件(在.do文件编辑器中)带时间戳(这样我可以将代码与日志匹配)?
例如,目前我有一个文件:
"K:\Common\HSRE\Hospice Payment Reform\Plotzke\Ad Hoc Tasks\OY1\BenefitPeriodAnalysis\code\Benefit period analysis (Code).do"
如果我每次运行。做文件,它会保存这将是巨大的:
"K:\Common\HSRE\Hospice Payment Reform\Plotzke\Ad Hoc Tasks\OY1\BenefitPeriodAnalysis\code\Benefit period analysis (Code)(`b')`a1'_`a2'_`a3'.do"
[或一些变化]
谢谢!这是一个非常简单的解决方案,可以满足我的需求。 – user2992957