ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
zaldarsa
Obsidian | Level 7

Hi!

I am looking at several medical history factors in relation to resistance to beta amyloid. I would like to output all the odds ratios along with wald confidence intervals into the same excel file so that I can make one odds ratio plot with all medical history variables. Additionally, is it possible to output an odds ratio graph from SAS that includes all the medical history variables? Thank you in advance for your help, and please let me if you would like me to clarify anything. I have attached below

%macro log (pred=);
proc logistic data=za.res plots(only)=oddsratio(logbase=2 range=(0.1,20)) ;
   class &pred (ref='0') uci_gender (ref='1') UCI_education( ref='0')/param=ref ;
   model resistance (event='0') = &pred UCI_agedeath uci_gender UCI_education/ link=logit  ;
   oddsratio &pred;
ods output OddsRatiosWald=orplots;
run;
%mend log;


%log(pred= HBP); *N=423, not significant 0.30;
%log(pred=stroke); *N=419, p=0.86;
%log(pred=cholest); *N=412, p=0.20;
%log(pred=diabete); *N=425, p= 0.87;
%log(pred=htloc); *N=421,p=0.92;
%log(pred=Glaucom); *N=419, p=0.60;
%log (pred=colon); *N=423,p=0.23;
%log(pred=syncope); *N=422,p=0.92;
%log(pred=thyroid); *N=420, p=0.54;
%log(pred= cataract); *N=422, p=0.04;
%log(pred= seizures); *N=423, p=0.07;

the code of the logistic regressions from which I am getting the odds ratios.

1 REPLY 1
ballardw
Super User

If you change your code on this line so that you create different data sets then you would have all them available to plot, print ore what have. As it is you overwrite the file and only have the one from the last run.

ods output OddsRatiosWald=orplots;

 You could get a different name by using something like below by adding the name of the variable to the set.

ods output OddsRatiosWald=orplots&pred.;

 

I'm not quite sure exactly what you may want for a "all variables" plot, but I suspect that it would involve combining the above data sets into a single one. There may be some fiddly bits involved stacking these sets as the Effect variable may have different lengths.

The Odds ratio plot is basically a Highlow plot for the confidence limits  with a scatter plot of the OR value overlaid.

I'm not sure exactly what you want the "all variables" plot to look like though that should get you started on that part.

 

You can place all of the output into a single xlsx with ods by placing all of the output you want between the ODS EXCEL and close statements

ods excel file="<path to file location>\filename.xlsx";

<all you code producing output you want in the file 
goes here>

ods excel close;

Likely you would want to provide some options for controlling sheets the output goes to but that is a separate topic.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 957 views
  • 0 likes
  • 2 in conversation