Hello everyone! I hope you are alright. I have a small problem. I would like my code to generate a single value from this loop (according to the num) and then append it to to the l_c variable, i.e. ideally I would have 27 observations in l_c variable. The value that I want to append is `m4', Thanks in advance!
Code:
gen l_c=.
foreach num of numlist 70/97 {
local m1 = `num'
display `m1'
local m2= `num'-1
local m3= m_tot_`m1' - m_tot_`m2'
display `m3' //Total Change
local m4= m_re_`m1' * ((n_re_`m1')/(n_kj_`m1'+n_cj_`m1'+n_fj_`m1'+n_re_`m1'))+( m_fj_`m1' *((n_fj_`m1')/(n_kj_`m1'+n_cj_`m1'+n_fj_`m1'+n_re_`m1')))-( m_bu_`m1' *((n_fj_`m1')/(n_kj_`m1'+n_cj_`m1'+n_fj_`m1'+n_re_`m1')))
local m5= `m3'-`m4'
display `m4' //Labour Change
display `m5' //Job Change
replace l_c = `m4'
}

Comment