Dear Stata list,

I want to generate an error list in a dta file on different conditions for data cleaning. I have searched the command like insertto or appendto but did't find any help in this regard.

for example:

bys hhid: appendto <varlist> if _n > 1 , using errors.dta comment("Duplicates")
bys hhid: insertto <varlist> if _n > 1 , using errors.dta comment("Duplicates")

appendto <varlist> if condition , using errors.dta comment("var1 = 1 and missing(var2)")

I know this can be done via post file after marking such records or using preserve/restore. It would be helpful if this could be done with just one command.

Thanks
Rasool Bux