Help using Base SAS procedures

Journal quality regression output table 2.

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 107
Accepted Solution

Journal quality regression output table 2.

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:

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

 

regression (1).png

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

..

 

 

 

 

 

 

 

 

 

  1. I want the standard errors to be parenthesis.
  2. I would like to see the stars next to the coefficient. 

The mistake will be in the array of my proc report, but I don’t know what exactly.

Thanks for your help.


Accepted Solutions
Solution
‎03-22-2018 07:54 AM
Trusted Advisor
Posts: 1,345

Re: Journal quality regression output table 2.

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).

View solution in original post


All Replies
Respected Advisor
Posts: 3,055

Re: Journal quality regression output table 2.

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.

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=proc&docsetTarget=p0n990vq8gxc...

 

 

--
Paige Miller
Frequent Contributor
Posts: 107

Re: Journal quality regression output table 2.

Posted in reply to PaigeMiller
Thanks for your reply. I thought I was doing that right before the proc report. See above. Did I do something wrong there?
Frequent Contributor
Posts: 107

Re: Journal quality regression output table 2.

Posted in reply to PaigeMiller
I am trying to write a picture format for the asterics. This is what I have so for:

proc format;
picture stderrf (round)
low-high=' 9.999)' (prefix='(')
.=' ';

picture asterics (round)
low - 0.01 = 9.999 (posttext='***')
0.01 < - < 0.05 = 9.999 (posttext='**')
0.1 -high = 9.999 (posttext='*')
0= (posttext='')
.=(posttext='')
run;

Posttext doesn't seem to work.

I get the following error message:
187 picture asterics (round)
188 low - 0.01 = 9.999 (posttext='***')
________
22
76
ERROR 22-322: Syntax error, expecting one of the following: DATATYPE, DECSEP, DIG3SEP, FILL, LANGUAGE, MULT, MULTIPLIER, NOEDIT,
PREFIX.
Do you happen to have any idea what else I could use?
Solution
‎03-22-2018 07:54 AM
Trusted Advisor
Posts: 1,345

Re: Journal quality regression output table 2.

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).

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 162 views
  • 0 likes
  • 3 in conversation