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;
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> ;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.