Pscore

#1
Hi

I am using STATA 12. I wish to do propensity score matching, hence I installed the command from "net sj 5-3 st0026_2".

The command works fine on my old variables, but I was unable to obtain a balanced covartes for all strata.

Hence I generated new variables, and ran pscore again but it stopped at 1 of the variables and stated "option pscore() required". What is this error and how do I rectify it?

Thank you.
 

bukharin

RoboStataRaptor
#2
This kind of question would be a lot easier to answer if you gave examples of your successful and unsuccessful commands with output (just copy and paste from the Results pane). The error message is telling you that you need to specify the pscore option, eg you may have typed:
Code:
pscore treatment varlist
But you needed to type:
Code:
pscore treatment varlist, pscore(newvar)
Remember that in Stata, "options" always come after the comma. See chapter 11 of the User's Guide.

In any case I think you have a better option - the -psmatch2- command, which I'm pretty sure is more popular, more powerful and more up to date. -psmatch2- is available on SSC (the Statistical Software Components archive) using:
Code:
ssc install psmatch2
 
#3
Thanks for the reply. But I still don't get it. I am new to STATA.

The old code that runs psscore, but with unbalanced properties:

clear all
set more off
set mem 300m
use "C:\Users\....\Desktop/inf5-state.dta", clear

gen moage_sq = moage*moage
gen moage_cb = moage*moage*moage

gen moeduc_sq = moeduc*moeduc
gen moeduc_cb =moeduc*moeduc*moeduc

gen hyprten_moage=hyprten*moage
gen hyprten_moeduc=hyprten*moeduc
gen hyprten_marstat=hyprten*marstat
gen hyprten_mohisp=hyprten*mohisp
gen hyprten_mowhite=hyprten*mowhite
gen hyprten_moblack=hyprten*moblack
gen hyprten_numpre=hyprten*numpre
gen hyprten_plural=hyprten*plural
gen hyprten_frst=hyprten*frst
gen hyprten_many=hyprten*many
gen hyprten_moage_sq = hyprten*moage_sq
gen hyprten_moage_cb = hyprten*moage_cb
gen hyprten_moeduc_sq = hyprten*moeduc_sq
gen hyprten_moeduc_cb = hyprten*moeduc_cb

gen moage_moeduc=moage*moeduc
gen moage_marstat=moage*marstat
gen moage_mohisp=moage*mohisp
gen moage_mowhite=moage*mowhite
gen moage_moblack=moage*moblack
gen moage_numpre=moage*numpre
gen moage_plural=moage*plural
gen moage_frst=moage*frst
gen moage_many=moage*many
gen moage_moeduc_sq = moage*moeduc_sq
gen moage_moeduc_cb = moage*moeduc_cb


gen moeduc_marstat=moeduc*marstat
gen moeduc_mohisp=moeduc*mohisp
gen moeduc_mowhite=moeduc*mowhite
gen moeduc_moblack=moeduc*moblack
gen moeduc_numpre=moeduc*numpre
gen moeduc_plural=moeduc*plural
gen moeduc_frst=moeduc*frst
gen moeduc_many=moeduc*many
gen moeduc_moage_sq = moeduc*moage_sq
gen moeduc_moage_cb = moeduc*moage_cb


gen marstat_mohisp=marstat*mohisp
gen marstat_mowhite=marstat*mowhite
gen marstat_moblack=marstat*moblack
gen marstat_numpre=marstat*numpre
gen marstat_plural=marstat*plural
gen marstat_frst=marstat*frst
gen marstat_many=marstat*many
gen marstat_moage_sq = marstat*moage_sq
gen marstat_moage_cb = marstat*moage_cb
gen marstat_moeduc_sq = marstat*moeduc_sq
gen marstat_moeduc_cb = marstat*moeduc_cb


gen mohisp_mowhite=mohisp*mowhite
gen mohisp_moblack=mohisp*moblack
gen mohisp_numpre=mohisp*numpre
gen mohisp_plural=mohisp*plural
gen mohisp_frst=mohisp*frst
gen mohisp_many=mohisp*many
gen mohisp_moage_sq = mohisp*moage_sq
gen mohisp_moage_cb = mohisp*moage_cb
gen mohisp_moeduc_sq = mohisp*moeduc_sq
gen mohisp_moeduc_cb = mohisp*moeduc_cb


gen mowhite_moblack=mowhite*moblack
gen mowhite_numpre=mowhite*numpre
gen mowhite_plural=mowhite*plural
gen mowhite_frst=mowhite*frst
gen mowhite_many=mowhite*many
gen mowhite_moage_sq = mowhite*moage_sq
gen mowhite_moage_cb = mowhite*moage_cb
gen mowhite_moeduc_sq = mowhite*moeduc_sq
gen mowhite_moeduc_cb = mowhite*moeduc_cb


gen moblack_numpre=moblack*numpre
gen moblack_plural=moblack*plural
gen moblack_frst=moblack*frst
gen moblack_many=moblack*many
gen moblack_moage_sq = moblack*moage_sq
gen moblack_moage_cb = moblack*moage_cb
gen moblack_moeduc_sq = moblack*moeduc_sq
gen moblack_moeduc_cb = moblack*moeduc_cb

gen numpre_plural=numpre*plural
gen numpre_frst=numpre*frst
gen numpre_many=numpre*many
gen numpre_moage_sq = numpre*moage_sq
gen numpre_moage_cb = numpre*moage_cb
gen numpre_moeduc_sq = numpre*moeduc_sq
gen numpre_moeduc_cb = numpre*moeduc_cb


gen plural_frst=plural*frst
gen plural_many=plural*many
gen plural_moage_sq = plural*moage_sq
gen plural_moage_cb = plural*moage_cb
gen plural_moeduc_sq = plural*moeduc_sq
gen plural_moeduc_cb = plural*moeduc_cb


gen frst_many=frst*many
gen frst_moage_sq = frst*moage_sq
gen frst_moage_cb = frst*moage_cb
gen frst_moeduc_sq = frst*moeduc_sq
gen frst_moeduc_cb = frst*moeduc_cb


gen many_moage_sq = many*moage_sq
gen many_moage_cb = many*moage_cb
gen many_moeduc_sq = many*moeduc_sq
gen many_moeduc_cb = many*moeduc_cb

compress

pscore cig hyprten moage moeduc marstat mohisp mowhite moblack numpre plural frst many moage_sq- many_moeduc_cb, pscore(ps) comsup numblo(5) blockid(block) logit detail

exit


Code (with new variables) that stopped:

clear all
set more off
set mem 300m
use "C:\Users\....\Desktop/inf5-state.dta", clear


gen moage_sq = moage*moage
gen moage_cb = moage*moage*moage
gen moage_4 = moage*moage*moage*moage
gen moage_5 = moage*moage*moage*moage*moage
gen moage_6 = moage*moage*moage*moage*moage*moage

gen moeduc_sq = moeduc*moeduc
gen moeduc_cb = moeduc*moeduc*moeduc
gen moeduc_4 = moeduc*moeduc*moeduc*moeduc
gen moeduc_5 = moeduc*moeduc*moeduc*moeduc*moeduc
gen moeduc_6 = moeduc*moeduc*moeduc*moeduc*moeduc*moeduc
gen moeduc_9 =moeduc*moeduc*moeduc*moeduc*moeduc*moeduc*moeduc*moeduc*moeduc

gen numpre_sq = numpre*numpre
gen numpre_cb = numpre*numpre*numpre

gen moeduc_9_drink = moeduc_9*drink
gen moeduc_9_mohisp = moeduc_9*mohisp
gen moeduc_9_moblack = moeduc_9*moblack
gen moeduc_9_mowhite = moeduc_9*mowhite
gen moeduc_9_numpre = moeduc_9*numpre
gen moeduc_9_many= moeduc_9*many

gen drink_mohisp = drink*mohisp
gen drink_mowhite = drink*mowhite
gen drink_moblack = drink*moblack

gen hyprten_moage=hyprten*moage
gen hyprten_moeduc=hyprten*moeduc
gen hyprten_marstat=hyprten*marstat
gen hyprten_mohisp=hyprten*mohisp
gen hyprten_mowhite=hyprten*mowhite
gen hyprten_moblack=hyprten*moblack
gen hyprten_numpre=hyprten*numpre
gen hyprten_plural=hyprten*plural
gen hyprten_frst=hyprten*frst
gen hyprten_many=hyprten*many
gen hyprten_moage_sq = hyprten*moage_sq
gen hyprten_moage_cb = hyprten*moage_cb
gen hyprten_moeduc_sq = hyprten*moeduc_sq
gen hyprten_moeduc_cb = hyprten*moeduc_cb

gen moage_drink=moage*drink
gen moage_moeduc=moage*moeduc
gen moage_marstat=moage*marstat
gen moage_mohisp=moage*mohisp
gen moage_mowhite=moage*mowhite
gen moage_moblack=moage*moblack
gen moage_numpre=moage*numpre
gen moage_plural=moage*plural
gen moage_frst=moage*frst
gen moage_many=moage*many
gen moage_moeduc_sq = moage*moeduc_sq
gen moage_moeduc_cb = moage*moeduc_cb


gen moeduc_marstat=moeduc*marstat
gen moeduc_mohisp=moeduc*mohisp
gen moeduc_mowhite=moeduc*mowhite
gen moeduc_moblack=moeduc*moblack
gen moeduc_numpre=moeduc*numpre
gen moeduc_plural=moeduc*plural
gen moeduc_frst=moeduc*frst
gen moeduc_many=moeduc*many
gen moeduc_moage_sq = moeduc*moage_sq
gen moeduc_moage_cb = moeduc*moage_cb
gen moeduc_sq_moage_sq = moeduc_sq*moage_sq


gen marstat_mohisp=marstat*mohisp
gen marstat_mowhite=marstat*mowhite
gen marstat_moblack=marstat*moblack
gen marstat_numpre=marstat*numpre
gen marstat_plural=marstat*plural
gen marstat_frst=marstat*frst
gen marstat_many=marstat*many
gen marstat_moage_sq = marstat*moage_sq
gen marstat_moage_cb = marstat*moage_cb
gen marstat_moeduc_sq = marstat*moeduc_sq
gen marstat_moeduc_cb = marstat*moeduc_cb


gen mohisp_mowhite=mohisp*mowhite
gen mohisp_moblack=mohisp*moblack
gen mohisp_numpre=mohisp*numpre
gen mohisp_plural=mohisp*plural
gen mohisp_frst=mohisp*frst
gen mohisp_many=mohisp*many
gen mohisp_moage_sq = mohisp*moage_sq
gen mohisp_moage_cb = mohisp*moage_cb
gen mohisp_moeduc_sq = mohisp*moeduc_sq
gen mohisp_moeduc_cb = mohisp*moeduc_cb


gen mowhite_moblack=mowhite*moblack
gen mowhite_numpre=mowhite*numpre
gen mowhite_plural=mowhite*plural
gen mowhite_frst=mowhite*frst
gen mowhite_many=mowhite*many
gen mowhite_moage_sq = mowhite*moage_sq
gen mowhite_moage_cb = mowhite*moage_cb
gen mowhite_moeduc_sq = mowhite*moeduc_sq
gen mowhite_moeduc_cb = mowhite*moeduc_cb


gen moblack_numpre=moblack*numpre
gen moblack_plural=moblack*plural
gen moblack_frst=moblack*frst
gen moblack_many=moblack*many
gen moblack_moage_sq = moblack*moage_sq
gen moblack_moage_cb = moblack*moage_cb
gen moblack_moeduc_sq = moblack*moeduc_sq
gen moblack_moeduc_cb = moblack*moeduc_cb

gen numpre_drink=numpre*drink
gen numpre_plural=numpre*plural
gen numpre_frst=numpre*frst
gen numpre_many=numpre*many
gen numpre_moage_sq = numpre*moage_sq
gen numpre_moage_cb = numpre*moage_cb
gen numpre_moeduc_sq = numpre*moeduc_sq
gen numpre_moeduc_cb = numpre*moeduc_cb


gen plural_frst=plural*frst
gen plural_many=plural*many
gen plural_moage_sq = plural*moage_sq
gen plural_moage_cb = plural*moage_cb
gen plural_moeduc_sq = plural*moeduc_sq
gen plural_moeduc_cb = plural*moeduc_cb


gen frst_many=frst*many
gen frst_moage_sq = frst*moage_sq
gen frst_moage_cb = frst*moage_cb
gen frst_moeduc_sq = frst*moeduc_sq
gen frst_moeduc_cb = frst*moeduc_cb


gen many_moage_sq = many*moage_sq
gen many_moage_cb = many*moage_cb
gen many_moeduc_sq = many*moeduc_sq
gen many_moeduc_cb = many*moeduc_cb

compress

pscore cig drink hyprten moage moeduc marstat mohisp mowhite moblack numpre plural frst many moage_sq-many_moeduc_cb, pscore(ps) comsup numblo(5) blockid(block) logit detail

exit


I think the issue is with "pscore(ps) comsup numblo(5) blockid(block) logit detail", I don't understand it at all, and I don't know how to modify it to work with the new set of variables.

Pls help.

Thank you.
 

bukharin

RoboStataRaptor
#4
That's strange, but again, please copy the commands and output from the Results window.

The set of options "pscore(ps) comsup numblo(5) blockid(block) logit detail" is all explained in -help pscore-