Hi all,
I have a three level treatment variable (no dose, low dose, and high dose) and I am trying to assess covariate balance after IPTW. I used the following code (adapted from codes in this document: https://www.lexjansen.com/wuss/2017/175_Final_Paper_PDF.pdf), however, I am getting an error that the response variable needs to be binary.
proc psmatch data=mydata; class gender maritalstatus education employment; psdata treatvar=mytreatment(Treated='High') ps=stabilizedps; assess ps var=(age gender maritalstatus education employment symptomscores) / plots=all; run;
Does anyone know how I can assess balance after IPTW for a three-level treatment variable?
Thank you!
As @Rick_SAS pointed out, the PSMATCH procedure only supports binary treatment variables, and all the balance diagnostics it produces are informed by this condition. Namely, all the balance diagnostics are for comparing two groups, a treatment level to a control level.
For inverse probability weighting, you in theory could try to use multiple runs of PROC PSMATCH to generate separate high-low and high-no comparisons. You would have to subset the data for each call, but the real trick to doing so would be appropriately modifying the input “propensity score” values so they result in the appropriate weight. This would require being familiar with 1) what those appropriate weights are 2) how PROC PSMATCH computes inverse probability weights from the input propensity scores, as described in the documentation, and 3) being aware of the fact that PROC PSMATCH assumes the value of the variable listed in the PS= option is always the predicted probability of receiving the designated treatment level (the TREATED= level). What the appropriate modification would be then depends on if you’re interested in estimating the ATE or ATT (note by default PROC PSMATCH uses IPTW ATT weights). One issue you might run into with this approach is if the modified propensity score values don’t result in any overlap between the treatment conditions, in which case PROC PSMATCH will return an error. You would also want to make sure ALLOBS support region is used (which is the default PROC PSMATCH uses for inverse probability weighting) so you don’t end up excluding data unexpectedly.
All that said, what is probably easier is to just compute the appropriate IPW weights directly in a bit of data step code and then produce your own weighted diagnostics using PROC SGPLOT and PROC FREQ. Would probably be much less error prone.
The error message is because the documentation for the PSDATA statement
SAS Help Center: PSDATA Statement
says:
names the treatment indicator variable, treatvar, which must be a binary classification variable that is specified in the CLASS statement.
The TREATED= suboption specifies the treated level for the binary treatment variable.
I don't know the answer to your question, but @MichaelL_SAS wrote a comment that might be related in another thread. Maybe it will be relevant for you: Coding ordinal predictors in proc psmatch - SAS Support Communities
As @Rick_SAS pointed out, the PSMATCH procedure only supports binary treatment variables, and all the balance diagnostics it produces are informed by this condition. Namely, all the balance diagnostics are for comparing two groups, a treatment level to a control level.
For inverse probability weighting, you in theory could try to use multiple runs of PROC PSMATCH to generate separate high-low and high-no comparisons. You would have to subset the data for each call, but the real trick to doing so would be appropriately modifying the input “propensity score” values so they result in the appropriate weight. This would require being familiar with 1) what those appropriate weights are 2) how PROC PSMATCH computes inverse probability weights from the input propensity scores, as described in the documentation, and 3) being aware of the fact that PROC PSMATCH assumes the value of the variable listed in the PS= option is always the predicted probability of receiving the designated treatment level (the TREATED= level). What the appropriate modification would be then depends on if you’re interested in estimating the ATE or ATT (note by default PROC PSMATCH uses IPTW ATT weights). One issue you might run into with this approach is if the modified propensity score values don’t result in any overlap between the treatment conditions, in which case PROC PSMATCH will return an error. You would also want to make sure ALLOBS support region is used (which is the default PROC PSMATCH uses for inverse probability weighting) so you don’t end up excluding data unexpectedly.
All that said, what is probably easier is to just compute the appropriate IPW weights directly in a bit of data step code and then produce your own weighted diagnostics using PROC SGPLOT and PROC FREQ. Would probably be much less error prone.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.