You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何永久存储eststo?使其不被Stata的clear命令清除

解决Stata中eststo结果不被clear all清除的方法
  • 把eststo结果保存到磁盘文件
    运行回归并通过eststo存储结果后,执行estsave using "结果文件名.ster", replace将结果写入本地文件。后续执行clear all后,只需用estimates use "结果文件名.ster"就能重新加载结果,还可以重新分配别名,比如eststo my_model: estimates use "结果文件名.ster"。

  • 替换clear all为精准清除命令
    clear all会清除内存中所有内容(包括eststo存储的回归结果),如果你的需求只是清除数据集,直接用clear即可;如果需要清除矩阵或Mata对象,用clear matrix或clear mata这类针对性命令,这样不会影响eststo的存储结果。

  • 借助estimates store+estimates save实现持久化
    eststo本质是estimates store的封装,你也可以直接用原生命令组合:

    sysuse auto, clear
    reg price mpg weight
    estimates store model1
    estimates save "model1_results.ster", replace
    clear all
    estimates use "model1_results.ster"
    esttab model1 // 可正常输出之前的回归结果
    

内容的提问来源于stack exchange,提问作者acubens555

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 14:35:20