Hello!
I created an propensity score and subsequently inverse probability weights for the variable "Autopsy", which indicates whether study participants underwent an autopsy or not. My primary predictor is cataracts (yes/no), and my outcome is amyloid resistant (yes/no).
I was wondering if I needed to include the variable Autopsy in my model when I anaylzed catarcts in relation to amyloid resistance, or if I just needed to include the weights. Thank you very much in advance!
*Create dataset with probability score;
proc logistic data=aut_path;
class gender edu drink;
model autopsy (event='1')= agevisit1 gender edu drink;
output out=outps(drop =_level_) prob=ps xbeta=xbeta;
run;
data lw_ps;
set outps;
if autopsy=1 then treated_ps=ps; else treated_ps=.;
if autopsy=0 then untreated_ps=ps; else untreated_ps=.;
run;
*Calculate mean propensity score;
proc means data=outps N MIN Q1 MEDIAN MEAN Q3 MAX STD;
class autopsy;
var ps;
output out=ps_mean mean=marg_prob;
run;
data _null_;
set ps_mean;
call symput ('marg_prob',marg_prob);
run;
*Create inverse probability weight and stabalized weight;
data res_analysis;
set outps;
if autopsy=1 then iptw=1/ps; else if autopsy=0 then iptw=1/(1-ps);
if autopsy=1 then siptw=&marg_prob/ps;
else if autopsy=0 then siptw=(1-&marg_prob)/(1-ps);
label ps='Propensity Score'
iptw = "Inverse Probability of Treatment Weight"
siptw = "Stabilized Inverse Probability of Treatment Weight";
run;
*Include people with autopsy only;
data aut;
set res_analysis;
if autopsy=1;
run;
proc logistic data=aut;
id id;
weight iptw;
class cataract (ref='0') ;
model amyloid (event='1')= cataract ;
oddsratio cataract;
run;