Good day Stata Friends,
I am trying to generate and replace a variable in Stata.
My study is on adolecents ages 10 - 19 year olds.
I have 2 school_fees variables data sets in 2 different files for each wave (5 waves in total). One file is for children 0-14 year old (nfs2); the other file is for adults above 14 (nfs1). In South Africa, schools that do not pay school fees (nfs) participate in feeding school program. I would like to generate a new variable, feeding scheme program (fsp).
I tried the following
First
gen nfs1 = schoolfees1 if child_age1>9 & child_age1<20
gen nfs2 = schoolfees2 if child_age1>9 & child_age1<20
gen fsp1 = nfs1 + nfs2
It came out blank
Second
gen nfs1 = schoolfees1 if child_age1>9 & child_age1<20
gen nfs2 = schoolfees2 if child_age1>9 & child_age1<20
gen fsp1 = 1 if nfs1>10 & nfs7>10 & (child_age1>9 & child_age1<20)
replace fsp1 = 0 if nfs1<=10 & nfs7<=10
This also came out wrong; showing only 1s and all over the place
In short, I would like nfs1 and nfs2 to be in the same row.
Thanks in advance.
Nthato
0 Response to Generate and Replace
Post a Comment