I am trying to calculate a propensity score (ps) using PROC LOGISTIC (I also tried using PROC GENMOD with a binary distribution and had the same problem). My outcome variable ('frcd_dic' is dichotomous). As you may notice, I am running these analyses on imputed data (consequently variables black, white, and eversex, which are typically dichotomous, are actually continuous). Below is the syntax I am using:
Proc logistic data = P2data11212014 descending;
class frcd_dic school class;
Model frcd_dic = school class Black White rlnshp ptnrage dysabsnt delinquency lifeSU eversex makesex
sexnorms sexbeliefs cntrlsex sexsixmo sixmoptnrA sexagr stoptryNZ refusesx / link = logit ;
by _imputation_;
output out = P2propensity_scores
p = ps
xbeta =plogit;
Run;
My problem is that 'ps' is not being calculated. After running this syntax I end up with a missing value 'ps' for all of my observations. I've spend a substantial amount of time trying to figure out my error and was hoping someone here could help me figure out what I am doing wrong. Not sure if this matters, but I am using SAS 9.4. Thanks in advance for your help!
Hard to say. Any other errors or notes in your log? How many observations in your data?
Add param=ref to your class statement as well.
Proc logistic data = P2data11212014 descending;
class frcd_dic school class/param=ref;
Model frcd_dic = school class Black White rlnshp ptnrage dysabsnt delinquency lifeSU eversex makesex
sexnorms sexbeliefs cntrlsex sexsixmo sixmoptnrA sexagr stoptryNZ refusesx / link = logit ;
by _imputation_;
output out = P2propensity_scores
p = ps
xbeta =plogit;
Run;
Thank you for your response. I actually am feeling quite foolish right now. There were no errors in the log, but there was a note saying that the variable ps already exist, so ps2 was used instead. The note was lost in the notes about the model converging in all 40 imputed datasets, so I hadn't noticed it. I ran the syntax several times with slight variations to try and create the variable 'ps' so that must be how it was previously created, but I'm still not sure why the variable kept coming back missing. I closed sas to clear my work file, re-opened it and ran my program and now I have my ps variable! Thank you again.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.