I was trying to understand how exactly Stata command teffects ipwra works on a binary outcome Y
by manually replicating every step described in Stata Treatment Effects Reference Manual pp 247-256.
All the numerical examples given in the manual are having a continuous outcome Y=bweight.

For a continuous Y, I can replicate all the results (POMs, ATE, ATET) produced by teffects ipwra,
by doing the following steps:
(1) use glm binomial logit to estimate a logistic regression model of the treatment 0/1 variable Z on
the covariate vector X=(1,x1,...,xp), save the fitted conditional means of Z as the propensity score
ps = P(Z=1|x), and then

(2) run two weighted linear regression models separately, one for the observed treatment outcomes Y1
on X, another for the observed control outcome Y0 on X, where the weights w are inverse-propensity
-scores: e.g., for ATE estimation, we define weights
w1 = 1/ps for treatment outcome observations Y1, w0 = 1/(1-ps) for control outcome observations Y0.
I do this step by running glm, Gaussian, identity, with analytic weights w1 and w0 as defined.

(2a) Being a weighted Gaussian regression, essentially it is equivalent to estimating an unweighted
linear regression of sqrt(w)Y on sqrt(w)X without intercept.

(3) save the linear regression fitted values Y1Hat and Y0Hat from the two regression respectively,
both for all X observations, treatment and control.
Then the sample mean of Y1Hat is POM1 and sample mean of Y0Hat is POM0, and the difference
is ATE as produced by teffect ipwra command directly.

For a binary outcome Y, I would have to do step (2) with glm binomial logit, with analytic weights
w1 and w0 as defined. The corresponding results using step (3) works out correctly, i.e., my manually
calculated POMs and ATE are the same as those produced by teffects ipwra directly.

My question now is: How do I carry out step (2a)? i.e., how to manually weight the binary outcome Y
and X using the inverse-propensity scores before running a glm binomial logit without specifying
further any analytic weights? The weighted Y values would not be binary anymore?

Could someone help explain?