Dear all SAS Expert,
On the way to convert my work from Stata to SAS, I reach the report table stage.
In STATA, I use the est sto and esttab to create a report table like that:
by using the code below
clear
*Insert dataset;
use "H:\datastata_24thApril\merge_treat_con.dta", clear
encode TYPE, generate(TYPE2)
encode GEOGN, generate(GEOGN2)
encode INDC3, generate(INDC32)
encode region, generate(region2)
*Setup firm-yearx ;
xtset TYPE2 yr
*Regression 1- without any conditional control;
areg wACC_PAY_TUR pt i.yr, a(TYPE2)
est sto m1
*Regression 2- control for firm and country control variables ;
areg wACC_PAY_TUR pt wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wTANGIBILITY wLAG_SAL_GRO i.yr, a(TYPE2)
est sto m2
*Regression 3- control for additional firm, country control variables ;
areg wACC_PAY_TUR pt wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wTANGIBILITY wLAG_SAL_GRO FCF wLOG_MVE wCAP_INT i.yr, a(TYPE2)
est sto m3
esttab m1 m2 m3,star(* 0.1 ** 0.05 *** 0.01) r2 label title(" **Account Payable Turnover-AREG** ") mtitle("w/o contr" "f&c_contr" "f&c_contr+") keep(pt wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wTANGIBILITY wLAG_SAL_GRO FCF wLOG_MVE wCAP_INT)
where each column is each regression, the number outside of the bracket is the coefficient of this variable, the number inside the bracket is the t-stat, for example, -0.15 is the coefficient of pt in the first regression, and -4.16 is the t-stat of it. The stars (*,**,***) are the significant levels of the coefficients.
Transform to SAS codes, I have the three associated regressions associate with three columns as below:
*Regression 1;
proc glm data=merge_treat_con;
ABSORB TYPE;
class yr / truncate;
model wACC_PAY_TUR= pt yr/solution ss3;
run;
quit;
*Regression 2;
proc glm data=merge_treat_con;
ABSORB TYPE;
class yr / truncate;
model wACC_PAY_TUR= pt wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wTANGIBILITY wLAG_SAL_GRO yr/solution ss3;
run;
quit;
*Regression 3;
proc glm data=merge_treat_con;
ABSORB TYPE;
class yr / truncate;
model wACC_PAY_TUR= pt wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wTANGIBILITY wLAG_SAL_GRO FCF wLOG_MVE wCAP_INT yr/solution ss3;
run;
quit;
I am wondering how to generate the Table in SAS like the asterisk Table above in Stata.
I really appreciate and thank you for having a look at my question. If I explain my question unclearly, please let me know that I can try my best to change it.
I try to look at the keyword "star statistical report" or "convert report table from stata to sas" or "SAS statistic report for multi regressions" but I still cannot find the answer for this curiousity.
Many thanks and warm regards.
What variable holds the P-value in the data set you want to create the table with?
You can display any text for a numeric value with a custom format. So once you get a report that displays the p-value then assign an appropriate format.
proc format; value sig 0 - 0.01 = '***' 0.01<- 0.05 = '**' 0.05<- 0.1 = '*' other=' '; run; data _null_; file print; do i= 1 to 25; x=rand('uniform'); Put "best format " x= best8. " sig format " x=sig.; end; run;
I sort of thought my first statistics teacher was kidding when he mentioned people do this "more significant" stuff with asterisks.
Hi @ballardw
Thank you for having a look at my question. I just edited the code and the result between SAS and STATA to make sure they are the same. Could you please have a look again at this? I really appreciate that.
Warmest regards and thanks.
My basic question remains, where is the value of the test statistic that determines significance and the other values?
To make anything resembling that desired output you will have to create a data set that is used by another procedure to display the values.
Since I have absolutely no way to know what that Stata output is showing other than the asterisks that you defined I can't help make that table.I don't speak Stata in any form so the code doesn't help me. Someone else may see that have some clues.
A properly structured data set with the contents described I can probably make something that looks similar from Proc Tabulate or another approach. But without a data set I haven't a chance. Likely you will need to use ODS OUTPUT with the procedure to get the values you want into data sets. You will likely have to work to combine the data set into a "nice" structure which would mean a variable that has the left column text, another variable that holds the text for the 3 'column' headers and 3 numeric variables for the values in the body of the report table. Then we get to spend some fiddling.
Or possibly using the DATA Step Report Writing Interface because it may be difficult to avoid crossing statistics since you would likely be mixing row (2 values superimposed) and column values(adding a column for the asterisks)
Thank you very much for your guidance @ballardw
Let me try to clarify what you hinted to me:
My basic question remains, where is the value of the test statistic that determines significance and the other values?
There are two values of the test statistic that determines significance: t-Value and Pr>|t| but normally I use Pr>|t| because of its simplicity
Let's use one result Table here for visual checking:
If Pr>[t] <0.001 the significant display is ***
Pr>[t] <0.05 the significant display is **
Pr>[t] <0.1 the significant display is *
Since I have absolutely no way to know what that Stata output is showing other than the asterisks that you defined I can't help make that table.I don't speak Stata in any form so the code doesn't help me. Someone else may see that have some clues.
Thank you very much for your kindness, @ballardw , you have helped me a lot
Or possibly using the DATA Step Report Writing Interface because it may be difficult to avoid crossing statistics since you would likely be mixing row (2 values superimposed) and column values(adding a column for the asterisks)
I did look at some documents from lexjansen but it seems not to be what I am looking for
The good news is that, by consulting with some people, I reach a previous SAS discussion here which may be the key for me to explore.
Thank you very much and cheers,
Phil.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.