我有一个 Python 脚本,它调用了几个 Statado
文件:
from subprocess import call
Stata_exec = "D:/Stata 12 MP2/StataMP-64.exe"
dofile = "D:/Test.do"
call( "\"{0}\" do /e \"{1}\"".format(Stata_exec, dofile), shell=True)
这是一个测试do
文件:
/* Merge some big files */
clear *
// Create dataset A (8000 variables, 300 observations)
set obs 300
gen ID = _n
forval i = 1/8000 {
gen variableA`i' = runiform()
}
tempfile dataA
save "`dataA'"
// Create dataset B (5000 variables, 300 observations)
clear
set obs 300
gen ID = _n
forval i = 1/5000 {
gen variableB`i' = runiform()
}
sort ID
// Attempt merge
merge 1:1 ID using `dataA'
exit, clear
我希望将do
文件的进度实时传输到控制台,因此它将与其他 Python 输出集成。
这可能吗?