Hi guys, I'm trying to replicate a paper but could not understand the meaning of the following commands. I tried googling it but still, the meaning is not clear to me.

foreach x in N_baseline {
qui gen `x'_T1=`x' if vote==1
qui gen `x'_T2=`x' if vote==0

foreach k in T1 T2 {
egen m_`k'=mean(`x'_`k')
local m_`k' = m_`k'
egen sd_`k'=sd(`x'_`k')
local sd_`k'= sd_`k'
}

quietly reg `x' vote, r
quietly test vote = 0
gen p_1= r(p)
local p_1 = p_1