BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tka726
Obsidian | Level 7

Hello!

I am completely new to PROC CAUSALTRT, and I am attempting to use this procedure for inverse weighting by the propensity score (IPTW) – comparing 2 treatment groups (coded 0, 1) on outcomes (coded as 0, 1). I am using ATE weights. I would like an odds ratio to compare groups.

 

This is what I have:

proc causaltrt data = ips descending METHOD=IPWR PPSMODEL;

   class outcome_ev  trtgrp female  diabyn hxsmokeyn ;

   psmodel trtgrp (REF="0") = age bmi female  diabyn hxsmokeyn ;  

   model outcome_ev = /  DIST=BIN;

     output out=causaltrt_ate PREDCNT=PREDCNT PREDTRT=PREDTRT

      ps=ps ipw=ipw;

   ods output CausalEffects=CausalEffects;

run;

 

I want an odds ratio; is it correct to take the exponent of the ATE estimate to get the odds ratio to compare treatments on the outcome?

 

data causal;

   set  CausalEffects;

   OR_= PUT(exp(estimate),20.5);

   OR_LOW= PUT(exp(lowerwaldcl),20.5);

   OR_UP= PUT(exp(upperwaldcl),20.5);

run;

 

This is the result I got: OR of 1.00046 ( 0.99980, 1.00113), pvalue of 0.174.

 

Just to see -  I also used GENMOD, and the result was very different:

   if trtgrp = 0 then weight1 = 1/(1-propensity);

   if trtgrp = 1 then weight1 = 1/(propensity);

 

 

proc genmod data= ips descending;

   weight weight1;

   class outcome_ev / param=ref; 

   model outcome_ev = trtgrp alpha = 0.05 dist=bin;

   estimate "trtgrp" trtgrp 1 / exp;

run;

 

Result from GENMOD: OR of 3.6999 ( 1.6562, 8.2656) pvalue of 0.001.

 

The results are so very different, I wasn’t sure that I was using PROC CAUSALTRT correctly. HELP!

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Typically, the difference is the most meaningful comparison of the treatments. You can compare that to the difference obtained using GENMOD by following it with the NLMeans macro to estimate the difference and its standard error and confidence interval on the mean (probability) scale. The following shows this using the example in the Getting Started section of the CAUSALTRT documentation. Note that the inverse proportional weights, as computed by the IPW= option in the OUTPUT statement, are used in GENMOD. The results are essentially the same, but CAUSALTRT uses a robust variance estimator, so the standard errors are a bit bigger as would be expected. 

proc causaltrt data=drugs method=ipwr ppsmodel;
   class Gender;
   psmodel Drug(ref='Drug_A') = Age Gender BMI;
   model Diabetes2(ref='No') / dist = bin;
   output out=out ps=ps ipw=ipw;
   ods output CausalEffects=ce;
run;
proc genmod data=out;
   weight ipw;
   class Drug(ref='Drug_A'); 
   model Diabetes2(ref='No') = drug / dist=bin;
   lsmeans drug / e ilink plots=none;
   store fit;
   ods output coef=Coeffs;
run;
%NLMeans(instore=fit, coef=Coeffs, link=logit)

View solution in original post

7 REPLIES 7
StatDave
SAS Super FREQ

Typically, the difference is the most meaningful comparison of the treatments. You can compare that to the difference obtained using GENMOD by following it with the NLMeans macro to estimate the difference and its standard error and confidence interval on the mean (probability) scale. The following shows this using the example in the Getting Started section of the CAUSALTRT documentation. Note that the inverse proportional weights, as computed by the IPW= option in the OUTPUT statement, are used in GENMOD. The results are essentially the same, but CAUSALTRT uses a robust variance estimator, so the standard errors are a bit bigger as would be expected. 

proc causaltrt data=drugs method=ipwr ppsmodel;
   class Gender;
   psmodel Drug(ref='Drug_A') = Age Gender BMI;
   model Diabetes2(ref='No') / dist = bin;
   output out=out ps=ps ipw=ipw;
   ods output CausalEffects=ce;
run;
proc genmod data=out;
   weight ipw;
   class Drug(ref='Drug_A'); 
   model Diabetes2(ref='No') = drug / dist=bin;
   lsmeans drug / e ilink plots=none;
   store fit;
   ods output coef=Coeffs;
run;
%NLMeans(instore=fit, coef=Coeffs, link=logit)
StatDave
SAS Super FREQ

Following up on MIchael's comment, if you particularly want to estimate the odds ratio (or relative risk) you can use code like the following after the CAUSALTRT step I showed earlier.

proc sql noprint;
   select stderr**2 as var format=15.12
   into :var1 - :var3
   from ce;
   quit;
data cov;
   keep col:;
   cov=(&var1+&var2-&var3)/2;
   col1=&var1; col2=cov; output;
   col1=cov; col2=&var2; output;
   run;
data ests; 
   set ce;
   where parameter="POM";
   run;
%nlest(inest=ests, incovb=cov, f=b_p1-b_p2, label=Difference of POMs)
%nlest(inest=ests, incovb=cov, f=b_p1/b_p2, label=Rel Risk of POMs)
%nlest(inest=ests, incovb=cov, f=(b_p1/(1-b_p1))/(b_p2/(1-b_p2)), label=Odds Ratio of POMs)

tka726
Obsidian | Level 7
Thank you!!
tka726
Obsidian | Level 7
Quick follow up question - will PROC CAUSALTRT calculate results if one group has 0 events?
MichaelL_SAS
SAS Employee

PROC CAUSALTRT requires subjects in both the treatment and control condition and will return an error either group has no subjects. 

MichaelL_SAS
SAS Employee

The ATE estimate reported by PROC CAUSALTRT is measured on the risk difference scale, that is the potential outcome mean for the treatment condition (POM1) minus the potential outcome mean for the control condition (POM0). Exponentiating this estimate will not give the the effect estimate on the odds ratio scale.

 

Instead what you can do is use the potential outcome mean estimates that are reported to compute the odds ratio, i.e. (POM1*(1-POM0) )/ (POM0 * (1-POM1) ). To compute confidence limits for this estimate you could apply the delta method. The Analysis of Causal Effects table reports estimates for the standard deviation of POM1 and POM2 and you can obtain the estimate for their covariance by using the identity VAR(ATE)=VAR(POM1 - POM0 ) = VAR(POM1) + VAR(POM0)- 2*COVAR(POM1, POM2).

 

 

tka726
Obsidian | Level 7
Thanks so much! Perfect!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 7 replies
  • 1544 views
  • 1 like
  • 3 in conversation