Dear all,
I posted two screenshots; one with regular SAS output from a logistic regression, where I adjusted the standard errors to be reported with parentheses. The other screenshot is an Excel spreadsheet picture of the table orientation that I would like to be able to run directly from SAS. I have not figured out how to have the estimates and the standard errors in one column per variable.
I appreciate your input.
Thank you,
Pieter
Here is an example based on data step processing
data class;
set sashelp.class;
old = age > 13;
run;
proc logistic data=class;
class old sex;
model old = sex | height | weight / noint;
ods output parameterEstimates=pe;
run;
data pe2;
set pe; where variable is not missing;
stdErrStr = put(estimate, 10.4);
output;
call missing(variable, probChiSq);
stdErrStr = cats("(", put(stdErr, pvalue8.4), ")");
output;
run;
options missing=" ";
proc print data=pe2 noobs;
var variable stdErrStr probChiSq;
label stdErrStr = "Estimate";
run;
Variable stdErrStr ProbChiSq Sex 70.9267 0.7576 (229.8318) Height 0.0413 0.7811 (0.1487) Height*Sex -0.9285 0.7983 (3.6329) Weight 0.4995 0.3898 (0.5809) Weight*Sex -1.1886 0.6238 (2.4237) Height*Weight -0.0083 0.3214 (0.0084) Height*Weight*Sex 0.0167 0.6605 (0.0380)
Note this forum interface does not do justice to the actual output. The formatting looks much better in the actual output.
I do not mind admitting that I might not have the chops to perform that specific task and the first sentence of your reply is confusing. I looked at several examples of the Proc Report statements but I have not found one that shows how to combine two variables that are originally in a horizontal orientation in one vertical column for each variable. The reason I am asking this is because I am running several regressions and I would prefer to not having to change the format of the SAS output in Excel each time.
Thank you.
Pieter
My first sentence means, SAS doesn't do this automatically for you. If you want a table that looks like that you'll need to build it yourself. This means saving the output needed from each run, combining them if necessary and restructuring/formatting as needed for display. PROC REPORT is used only for displaying it at the end.
There's a paper from Cynthia Zender titled Creating Complex Reports that outlines how to do these type of reports. You can also find the zip file that has the programs so you can follow along.
Here is an example based on data step processing
data class;
set sashelp.class;
old = age > 13;
run;
proc logistic data=class;
class old sex;
model old = sex | height | weight / noint;
ods output parameterEstimates=pe;
run;
data pe2;
set pe; where variable is not missing;
stdErrStr = put(estimate, 10.4);
output;
call missing(variable, probChiSq);
stdErrStr = cats("(", put(stdErr, pvalue8.4), ")");
output;
run;
options missing=" ";
proc print data=pe2 noobs;
var variable stdErrStr probChiSq;
label stdErrStr = "Estimate";
run;
Variable stdErrStr ProbChiSq Sex 70.9267 0.7576 (229.8318) Height 0.0413 0.7811 (0.1487) Height*Sex -0.9285 0.7983 (3.6329) Weight 0.4995 0.3898 (0.5809) Weight*Sex -1.1886 0.6238 (2.4237) Height*Weight -0.0083 0.3214 (0.0084) Height*Weight*Sex 0.0167 0.6605 (0.0380)
Note this forum interface does not do justice to the actual output. The formatting looks much better in the actual output.
Thank you so much; that is exactly what I am looking for.
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.