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:

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.

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

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

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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
GKati
Pyrite | Level 9
Thanks for your reply. I thought I was doing that right before the proc report. See above. Did I do something wrong there?
GKati
Pyrite | Level 9
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?
mkeintz
PROC Star

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

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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