Hello Everyone,
Following on the post by zzecon
I would also like to produce regression output like this one:
Using the following code, I get a slightly diffferent output.
proc format;
picture stderrf (round)
low-high=' 9.9999)' (prefix='(')
.=' ';
run;
proc report data=parmest nowd out=table;
column type dependent variable value1 value2;
define numord /noprint;
define variable /display ' ';
define type / display;
define dependent / across ' ';
define value1 /display;
define probt1 /display;
define value2 /display;
define probt2 /display;
compute value;
array cc _c8_ _c5_ ;
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:
type | indavgcost |
| value1 | value2 |
coefficient | 1 | Intercept | 2154.033 | 2361.4119 |
stderr | 1 | Intercept | 3.9858111 | 22.628486 |
coefficient | 1 | tag13 | 101.8107 | 73.756248 |
stderr | 1 | tag13 | 8.189885 | 8.1373222 |
coefficient | 1 | avgcontract | -736.7952 | -578.251 |
stderr | 1 | avgcontract | 10.062152 | 10.037246 |
coefficient | 1 | tag13*avgcontract | -80.84143 | -100.5845 |
stderr | 1 | tag13*avgcontract | 20.23273 | 20.126612 |
coefficient | 1 | ses | . | -74.14517 |
stderr | 1 | ses | . | 2.3641456 |
coefficient | 1 | female | . | -54.42843 |
….. |
|
|
|
|
|
|
|
|
|
The mistake will be in the array of my proc report, but I don’t know what exactly.
Thanks for your help.
Instead of a posttext= parameter, use the same technique you used in the stderrf format:
proc format;
picture asterics (round)
low - 0.01 = '9.999***'
0.01 < - < 0.05 = '9.999**'
0.1 -high = '9.999*';
run;
data _null_;
do sig=.001 ,.005 ,.01 ,.03 ,.05 ,.1,.8;
put sig= @12 sig=asterics.;
end;
run;
BTW, I think you left some holes in your value boundaries in the format (see the .05 formatted value).
To get parenthesis around your standard errors, and asterisks next to the p-values, you need to create a PICTURE format, and assign that format to the proper variable in PROC REPORT.
Instead of a posttext= parameter, use the same technique you used in the stderrf format:
proc format;
picture asterics (round)
low - 0.01 = '9.999***'
0.01 < - < 0.05 = '9.999**'
0.1 -high = '9.999*';
run;
data _null_;
do sig=.001 ,.005 ,.01 ,.03 ,.05 ,.1,.8;
put sig= @12 sig=asterics.;
end;
run;
BTW, I think you left some holes in your value boundaries in the format (see the .05 formatted value).
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.