My 1st do file is (a much shorter version):
Code:
clear *
use "/Users/zhaoyao/Documents/wiki/daily_contribution.dta" 
cd "/Users/zhaoyao/Documents/wiki"
rename *, lower

*same codes as 2nd .do file

local name "Panel A. Contributions from all contributors:"
matrix rownames table1 = "`name'Addition" "`name'Deletion" "`name'Total"
matrix colnames table1 = "Mean" "Standard Error" "Mean" "Standard Error" "t-stats" 
                     
estout matrix(table1, fmt(2))
#delimit ;
estout matrix(table1, fmt(2)) using table1_panelA.tex, 
style(tex) 
replace
mlabels(,none) collabels(,none)
;
My 2nd file has the same beginning (.dta file) as 1st .do file. But it has more codes before the "same codes as 2nd f.do ile". And it has a little bit different at the end of 1st do file.

Code:
use "/Users/zhaoyao/Documents/wiki/daily_contribution.dta" 
cd "/Users/zhaoyao/Documents/wiki"
rename *, lower

Above are the same as 1st.
has some new stuff

*same codes as 1st .do file

local name "Panel B. Contributions from nonblocked contributors:"
matrix rownames table1 = "`name'Addition" "`name'Deletion" "`name'Total"

matrix colnames table1 = "Mean" "Standard Error" "Mean" "Standard Error" "t-stats" 
                     
estout matrix(table1, fmt(2))

#delimit ;
estout matrix(table1, fmt(2)) using table1_panelB.tex, 
style(tex) 
replace
mlabels(,none) collabels(,none)
;
I'm asking Stata veteran's opinion. If you are in charge, will you and how do you simplify these 2 do files?