I want to estimate the causal effect of a treatment variable D (which is binary) on outcome variable (Y) using covariates (X). That is I want to run a regression like:

reg Y D X

However, instead of running the regression on the full sample, I want to first generate propensity scores for D based on covariates X and then keep only those observations with propensity score lying strictly between 0.1 and 0.9.

That is, I want to run the above regression on the sample screened based on the propensity score. While I can manually screen the sample by dropping the observations with pscore outside 0.1 to 0.9 range and then run the regression on the remaining sample, the final standard errors will not be quite right as it will not be reflecting the fact that the sample has been screened using propensity score which in turn has been estimated. Thus I wanted to know how to ensure in STATA that the final estimates of the regression have standard errors which account for the fat that the sample is screened based in the propensity score?

Thank you.