BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GKati
Pyrite | Level 9

 

Hello Everyone,

 

Following on the post by zzecon

(https://communities.sas.com/t5/SAS-Procedures/Making-a-publication-quality-table-from-regression-res...)

I would also like to produce regression output like this one: regression (1).png

Using the following code, I get a slightly diffferent output.

 

/*write a dataset with standard error on the same column of coefficient*/

data parmest_;

set work.parmest;

if not missing(stderr) and variable not in ('R-Square','Root MSE','N. Obs.') then do;

value=estimate; type='coefficient'; output; end;

if not missing(stderr) then do; value=stderr; type='stderr' ;output; end;

if variable in ('R-Square','Root MSE','N. Obs.') then do; value=estimate; type=variable ;output; end;

run;

proc format;

picture stderrf (round)

low-high=' 9.9999)' (prefix='(')

.=' ';

run;

 

 

proc report data=parmest_ nowd out=table;

column numord variable type dependent, (probt value);

define numord /group order=data noprint;

define variable / group order=data ' ';

define type / group order=data noprint;

define dependent / across ' ';

define value /analysis sum;

define probt /analysis sum;

compute value;

array cc _c8_ _c6_ _c4_ ;

if type='stderr' then do;

call define(_col_,'format','stderrf.');

end;

else do;

call define(_col_,'format','8.4');

do i= 1 to 3;

if ~missing(cc(i)) then do;

if 0.05<cc(i) <= 0.1 then call define(_col_, "style", "style=[ posttext='*']" );

else if 0.01 <cc(i) <=0.05 then call define(_col_, "style", "style=[ posttext='**']" );

else if cc(i) <= 0.01 then call define(_col_, "style", "style=[ posttext='***']" );

leave; end;

end;

end;

endcomp;

run;

 

This is what my output table looks like:

 

I see two problems:

1. I have two regressions.  I would like to see the output side-by-side (as above) I only see one here.

2. the coefficients and standard error values are actually different than in my table (attached), as if I would changing it unintentionally.

 

Thanks for your help.

 

  indavgcostPr > |t| value
Intercept<.00018453.102***
 <.0001(1.3810)
tag130.7400-127.069
 0.7400(9.6254)
avgcontract<.0001-1224.34***
 <.0001(8.2317)
tag13*avgcontract1.556246.4737
 1.5562(2.5511)
ses0.0530-42.3237*
 0.0530(1.8749)
female0.0064-780.368***
 0.0064(6.3947)
age_gr<.0001-2138.21***
 <.0001(4.8519)
age_gr<.0001-1909.67***
 <.0001(4.0391)
age_gr<.0001-1802.40***
 <.0001(2.4117)
age_gr<.0001-1830.20***
 <.0001(0.5354)
age_gr<.0001-1448.62***
 <.0001(3.2364)
age_gr<.0001-1609.45***
 <.0001(1.8672)
age_gr<.0001-1557.71***
 <.0001(4.7518)
age_gr<.0001-1618.78***
 <.0001(1.6792)
age_gr<.0001-1112.25***
 <.0001(4.4247)
age_gr<.0001-1069.81***
 <.0001(3.9204)
age_gr<.0001-1245.90***
 <.0001(0.5962)
age_gr<.0001-1336.19***
 <.0001(7.3560)
age_gr<.0001-1608.00***
 <.0001(6.7212)
age_gr<.0001-1644.24***
 <.0001(7.9121)
age_gr<.0001-993.303***
 <.0001(8.1234)
age_gr<.0001-1310.02***
 <.0001(2.4610)
age_gr<.0001-1282.29***
 <.0001(9.3784)
age_gr0.5106210.1890
 0.5106(9.4449)
age_gr0.0015-1615.85***
 0.0015(0.1211)
female*age_gr0.00131127.503***
 0.0013(0.1875)
female*age_gr0.0033992.5148***
 0.0033(7.4810)
female*age_gr0.0353694.6752**
 0.0353(9.9497)
female*age_gr0.0659623.0732*
 0.0659(8.8363)
female*age_gr0.1377504.2382
 0.1377(9.6422)
female*age_gr<.00011491.246***
 <.0001(3.3474)
female*age_gr<.00011339.971***
 <.0001(8.7947)
female*age_gr0.00101102.112***
 0.0010(4.9940)
female*age_gr0.0991536.0772*
 0.0991(5.0355)
female*age_gr0.9996-0.1699
 0.9996(4.0705)
female*age_gr0.0296700.1651**
 0.0296(1.9080)
female*age_gr0.0951534.5546*
 0.0951(0.2453)
female*age_gr0.0134788.9965**
 0.0134(9.1323)
female*age_gr0.1294491.9362
 0.1294(4.3554)
female*age_gr0.0600624.4005*
 0.0600(1.9166)
female*age_gr0.00061197.305***
 0.0006(8.4239)
female*age_gr0.0184860.5910**
 0.0184(5.0921)
female*age_gr0.0267-959.616**
 0.0267(2.9871)
female*age_gr0.1352921.4893
 0.1352

(6.853)

1 ACCEPTED SOLUTION

Accepted Solutions
GKati
Pyrite | Level 9
Thx for your reply. I've actually found some mistakes. i will close this question and reopen another one with new dataset and code. Tx.

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

1. Both outputs need to be somehow merged into the same data set and then run PROC REPORT to get both outputs side-by-side.

 

2. Give us a specific example, so we don't have to scroll through this mass of data and find the discrepancy on our own.

--
Paige Miller
GKati
Pyrite | Level 9
Thx for your reply. I've actually found some mistakes. i will close this question and reopen another one with new dataset and code. Tx.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1960 views
  • 0 likes
  • 2 in conversation