BookmarkSubscribeRSS Feed
msarin
Calcite | Level 5

I have generated the following macro for differences of differences (2 procedures, 2 time periods) in a multivariable logistic regression model to compare 2 procedures' changes between 2 time periods. First of all, are my -1 and 1 coefficients in the lsmestimate statement correct?  Secondly, how do I take a step back to compare just the 2 time periods (regardless of procedure) and get p values and odds ratios for the comparison? I thought this would be the easier part.

* Perform multivariate regression on predictors of readmission, reoperation, and morbidity for differences of differences in Tables 3-5;
%macro logodds(var);
proc logistic data=data09_19;
class time proc race_o smoking hypertension dial ASA_ge3 plf_adj rev_surg / param=glm ref=first;
model &var(event="1") = time proc time*proc age1 race_o smoking hypertension dial ASA_ge3 tothlos plf_adj rev_surg;
lsmeans time*proc / e ilink adjust=bon;
lsmestimate time*proc "Diff in Diff LogOdds" 1 -1 -1 1;
ods output modelanova=anova oddsratios=odds;
store log;
proc print data=anova;
proc print data=odds;
proc export data=anova
outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var._anova.xls"
dbms=xls replace;
proc export data=odds
outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var._odds.xls"
dbms=xls replace;
run;
%mend logodds;
%logodds(readm_c);
%logodds(reop_c);
%logodds(morbidity_c);
run;

 

1 REPLY 1
msarin
Calcite | Level 5

I ended up cleaning up the redundancy in the above macro and coming up with the second one below in answer to my own question.  Does anybody have any comments?

 

 

* Perform multivariate regression on predictors of readmission, reoperation, and morbidity for differences of differences in Tables 3-5;

%macro logodds(var);

  proc logistic data=data09_19;

    class time proc race_o smoking hypertension dial ASA_ge3 plf_adj rev_surg / param=glm ref=first;

    model &var(event="1") = time proc time*proc age1 race_o smoking hypertension dial ASA_ge3 tothlos plf_adj rev_surg;

    lsmeans time*proc / e ilink diff oddsratio cl adjust=bon;

    ods output modelanova=anova oddsratios=odds;

    store log;

  proc print data=anova;

  proc print data=odds;

  proc export data=anova

    outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var._anova.xls"

    dbms=xls replace;

  proc export data=odds

    outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var._odds.xls"

    dbms=xls replace;

  run;

%mend logodds;

%logodds(readm_c);

%logodds(reop_c);

%logodds(morbidity_c);

run;

 

 

* Perform multivariate regression on predictors of readmission, reoperation, and morbidity to compare time periods within each surgical approach in Tables 3-5;

%macro logodds_times(var,prc);

  proc logistic data=data09_19;

   class time proc race_o smoking hypertension dial ASA_ge3 plf_adj rev_surg / param=glm ref=first;

    model &var(event="1") = time proc time*proc age1 race_o smoking hypertension dial ASA_ge3 tothlos plf_adj rev_surg;

    where proc=&prc;

    lsmeans time*proc / e ilink diff oddsratio cl adjust=bon;

    ods output modelanova=anova oddsratios=odds;

    store log;

  proc print data=anova;

  proc print data=odds;

  proc export data=anova

    outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var&prc._anova_times.xls"

    dbms=xls replace;

  proc export data=odds

    outfile="E:\LogonData\UserFolders\sarinm\anterior_vs_posterior_fusion\&var&prc._odds_times.xls"

    dbms=xls replace;

  run;

%mend logodds_times;

%logodds_times(readm_c,1);

%logodds_times(readm_c,2);

%logodds_times(reop_c,1);

%logodds_times(reop_c,2);

%logodds_times(morbidity_c,1);

%logodds_times(morbidity_c,2);

run;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 359 views
  • 0 likes
  • 1 in conversation