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
Related Posts with Generate and Replace
Extracting information out of matrices' observations.Hey, I have a dataset of around 50 vars and 30k obsevations. I have created a matrix that stores re…
Lagged Dependent Variable (Panel)Is it appropriate to include the dependent variable as a control in an FE panel regression. Previous…
A few questions about my analysis in StataDear all, I am new on this forum, so I hope I'm posting these questions on the right place. I am n…
Fixed Effects: Variables Indexed by Country, Sector and TimeI am trying to run a regression for fixed effects specifications. The dependent variable is Volatili…
event study linear regression modelDear all, I read previous posts about event study, but I still cannot find my starting point for co…
Subscribe to:
Post Comments (Atom)
0 Response to Generate and Replace
Post a Comment