BookmarkSubscribeRSS Feed
olliegeorge
Calcite | Level 5

Hello, I wrote a macro to perform several logistic regressions for the same outcome variable but several different exposure variables. Is there a way to create a table that contains all the odds ratios and 95% confidence intervals for all ResExp variables. 

 

%macro dd_singlepest;
%do i = 1 %to 47;
proc logistic data=ev.pregev_Dataall;
model neuro(event='1') = ResExp&i birthyear female mage hispan ses;
run;
%end;
%mend;

1 REPLY 1
ballardw
Super User

I think you may want to use ODS OUTPUT to place the odds ratio information into a data set. Then combine the data sets (proc append or data step)

 

See if the set OddResExp1 created below has what you want.

ods output oddsratios= OddResExp1;
proc logistic data=ev.pregev_Dataall;
model neuro(event='1') = ResExp1 birthyear female mage hispan ses;
run;

If so you should be able to create an output set for each by using &i in the OdsResExp instead of 1.

Then combine.

 

Note that all the different output object names created by your code are available setting ODS TRACE ON; before running a procedure. You can then use ODS OUTPUT to create sets for each name using pairs of object/dataset names. Turn the trace off using: ODS TRACE OFF; after the procedure.

 

Ods Output <object name> = <my data set name> ;

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 595 views
  • 0 likes
  • 2 in conversation