SAS可以作为STATA esttab吗?

时间:2017-05-13 07:51:49

标签: sas

STATA有一个很棒的代码 esttab ,可以在一个表格中报告多个回归。每列都是回归,每行都是一个变量。 SAS可以做同样的事情吗?我只能在SAS中获得如下内容。然而,桌子并不像esttab那么漂亮。

提前致谢。

data error;
input Y X1 X2 X3 ;
datalines;
4   5  6  7
6   6  5  9
9   8  8  8
10  10 2 1
4   4 2 2 
6   8 3 5 
4   4 6 7
7   9 8 8 
8   8 5 5
7   5 6 7
9  8 9 8
0 2 5 8
6 6 8 7
1 2 5 4
 5 6 5 8
 6 6 8 9
 7 7 8 2
 5 5 8 2
 5 8 7 8
run;
PROC PRINT;RUN;

   proc reg data=error outest=est tableout alpha=0.1;
M1: MODEL Y =  X1 X2      / noprint;
M2: MODEL Y =  X2 X3      / noprint;
M3: MODEL Y =  X1 X3      / noprint;
M4: MODEL Y =  X1 X2   X3    / noprint;
   proc print data=est;
   run;

2 个答案:

答案 0 :(得分:0)

我没有使用Stata,但知道它是我项目的一部分。不幸的是,使用SAS没有好办法。您可以尝试安装并使用最新的Tagsets来获得所需的输出。 excltags.tpl在这种情况下应该有所帮助。

像,

ods path work.tmplmst(update) ;
filename tagset url 'http://support.sas.com/rnd/base/ods/odsmarkup/excltags.tpl';
%include tagset;

以上安装Tagsets并将其存储在Work中。这不会破坏系统上已安装的标签集。此外,每次打开新的SAS会话时都需要执行此步骤。

    ods listing close;
    ods tagsets.ExcelXP file='Excelxp.xml';
#Your Code#
    proc reg data=error outest=est tableout alpha=0.1;
    M1: MODEL Y =  X1 X2      / noprint;
    M2: MODEL Y =  X2 X3      / noprint;
    M3: MODEL Y =  X1 X3      / noprint;
    M4: MODEL Y =  X1 X2   X3    / noprint;
    proc print data=est;
    run;
#Your Code#
    ods tagsets.ExcelXP close;

我目前在家用台式机上,没有安装SAS,我没试过。这应该将回归结果导出到包含系数,显着性等级的表格中。

如果有效,请告诉我。另外,请参阅此Document以获取更多信息。

答案 1 :(得分:0)

感谢Praneeth Kumar的灵感。我从http://stats.idre.ucla.edu/sas/code/ummary-table-for-multiple-regression-models/

找到了相关信息

我改变它以满足我的需要。

/*1*//*set the formation*/
proc format;           
    picture stderrf (round)       
        low-high=' 9.9999)' (prefix='(')                                
            .=' ';                                                  
run;
/*2*//*run the several regressions and turn the results to a dataset*/
ods output ParameterEstimates (persist)=t;                     
 PROC REG DATA=error;
 M1: MODEL Y =  X1 X2    ;
M2: MODEL Y =  X2 X3    ;
M3: MODEL Y =  X1 X3     ;
M4: MODEL Y =  X1 X2   X3   ;
run;                                                                
 ods output close;                                                   

proc print data=t;                                                  
run;
   /*3*//*use the formation and the dataset change into a table*/
proc tabulate data=t noseps;      
  class model variable;                      
  var estimate Probt;     
  table variable=''*(estimate =' '*sum=' '                          
                     Probt=' '*sum=' '*F=stderrf.),                
         model=' '                                                  
          / box=[label="Parameter"] rts=15 row=float misstext=' '; 
run;