Hey Everyone,
At some point in our research assignments we might need to use
probability weights so I've taken the liberty to include some useful code here from Ajay's solowhh_factpred.do. (There might be other bits of useful code lying around that I didn't notice)
//////////////////////
///(1) weighting options
//Do we want to attempt to reweight or not?
local useweights 0
local weightfolder1 stylized
local weightfolder0 stylized_noweight
//////////////////////
//(2) If we don't want weights, equalize them
if !`useweights' {
foreach var of varlist weight71 wt82 weight99 {
replace `var' = 1
}
}
I think that the first part "local useweights 0" basically states whether or not you want to use weights in your analysis. The second part sets all weights to 1 if you don't want to use weights for your analysis. In this way, you can include the command [pweight=___] in your entire code and just change the macro `useweights' to 0 or 1 (?) if and when you want to run weighted or unweighted regressions etc.
Also, this is a nice FAQ that explains how to construct variables containing weighted summary statistics since commands like egen doesn't support weights (although the package -egenmore- might be useful):
http://www.stata.com/support/faqs/data-management/weighted-group-summary-statistics/Thanks.
Best,
Gedeon