2017-05-13 177 views
0

STATA有一個美妙的代碼esttab報告一個表中的多個迴歸。每列是一個迴歸,每一行都是一個變量。 SAS可以做同樣的事情嗎?我只能像下面這樣在SAS中獲得一些東西。但是,桌子並不像esttab那麼美麗。SAS可以做STATA 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; 
+0

當您在'Stata'中使用'Esttab'時,請分享輸出截圖。這會有所幫助。 –

+0

請描述你想要的輸出,並解釋它與你從PROC REG得到的不同。 – Quentin

回答

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瞭解更多信息。

+0

謝謝@Praneeth庫馬爾。你給了我靈感。我想我找到了追求的答案。 –

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;