*! 13aug2010 program appendl, rclass version 8.2 syntax anything,[cd Alias(string) keep(string) NOLabel NONotes Quiet xconfig(string)] mata: pathback("`anything'","file", ".dta") *pathutil `anything', defext(.dta) pfe(fullorig) p(path) fe(file) e(ext) capture confirm file "`pbpfe'" if (_rc) { di "No file found to append: `pbpfe'" exit // this is not an error, just an info message } if ~inlist("`pbext'",".dta",".tmp") { tempfile t callst `pbpfe', dest(`t') config(`xconfig') local fulluse `t' } else local fulluse `pbpfe' if ~mi("`keep'") { mata: st_local("both",concat(varlist(st_local("keep"),st_local("fulluse"))," ")) di "{txt:Kept `:list sizeof both': `both'}" } capture qui append using "`fulluse'", keep(`both') `nolabel' `nonotes' if (_rc==3) { //no dataset in use gen bs=0 qui append using "`fulluse'", keep(`both') `nolabel' `nonotes' drop bs } else if (_rc) error _rc qui compress if ~mi("`cd'") cd "`pbpath'" if ~mi("`alias'") global `alias' `pbpfe' *if mi("`quiet'") recent, file("`pbpfe'") notice("-inc") return local vars `both' end