log using example1,text replace set maxvar 8000 use "../bytaxunit/dta/scftax19" generate weight=x42001/5 generate rep = mod(y1,10) generate taxunit = mod(taxsimid,10)+1 taxsim32,replace # Sum a tax-unit variable by marital status table mstat [pw=weight],c(sum fiitax) # Correct standard errors for replicates for a taxunit variable micombine regress fiitax [pw=weight],obsid(y1) impid(rep) # With a household variable (Total Income) for household heads only micombine regress x5729 [pw=weight] if taxunit<=1,obsid(y1) impid(rep) micombine regress fiitax x5729 [pw=weight] if taxunit<=1,obsid(y1) impid(rep) sum fiitax x5729 weight if taxunit<=1 # Aggregate the tax results to household level so all taxpayers are # included in a household level regression. collapse (mean) x5729 weight rep (sum) fiitax,by(y1) micombine regress x5729 [pw=weight],obsid(y1) impid(rep) micombine regress fiitax x5729 [pw=weight],obsid(y1) impid(rep) sum fiitax x5729 weight