2月 20, 2011

Posted in 数据处理 | 8 条评论

SAS中保存统计分析步的结果至数据集中

在我们做完统计分析步(如proc reg等)后,有时想要将某些结果数据保存在数据集中,较为简单的常用方法有下面三种:使用proc步结果输出选项,使用output语句,使用ods output的方法。

下面以较为常用的proc reg步进行举例说明:

1.使用proc reg步结果输出选项

在proc reg ; 的options中可以选择outest= 选项来产生一个数据集,用于存储参数估计值、模型拟合的相关统计值等;同时还有edf、outseb、tableout、sse等选项(其他更多选项参见SAS help文档),可以将你想要的统计分析结果存储于outest= 生产的数据集中。

  • OUTEST= outputs a data set that contains parameter estimates and other model fit summary statistics
  • EDF outputs the number of regressors, the error degrees of freedom, and the model R2 to the OUTEST= data set
  • OUTSEB outputs standard errors of the parameter estimates to the OUTEST= data set
  • TABLEOUT outputs standard errors, confidence limits, and associated test statistics of the parameter estimates to the OUTEST= data set

例:

proc reg data=sashelp.class outest=result1 edf sse;
	model weight=height;
quit;

数据集work.result1如下:

继续阅读
返回顶部