Below is the code that i used to calculate monthly residuals following Fama and French three Factor model using within month daily data:

egen ccode = group(stock)
egen count_check = count(rt), by(stock month)
drop if count_check <17
egen ccode_month_year = group(stock month year)
gen resid_reg =.
egen max = max(ccode_month_year)
disp max
for values i = 1(1)6022 {
regress rt mkt smb hml if ccode_month_year==`i'
predict temp , resid
replace resid_reg = temp if ccode_month_year==`i'
drop temp
}

Could someone help me to modify this code so that instead of saving regression residuals each month, it generates sum of three slope coefficients of the regression as output.