I have the following 2 variables that serve the same purpose and I'm trying to generate one variable for both. Schoolfees1 has school values for ages 15 years to 19 years. Schoolfees2 is school values for ages 10 to 14 year olds. I would like to generate an overall fees variable called fees1 and would like the amount of school fees to show. The results shows as 0 or 1.
Code:
gen fees1 = schoolfees1 | schoolfees2 if age1>9 & age1<20
*Please note that gap are other ages that are not part of the equation. I'm only interested in ages 10 to 19 year old
input long(schoolfees1 schoolfees2) float fees1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
7500 . 1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
700 . 1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
4000 . 1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
250 . .
100 . 1
15 . 1
. . .
250 . 1
. . .
. . .
. . .
. . .
. . .
. . .
50 . 1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . 1
. . .
. . .
. . .
650 . 1
. . .
. . .
. . .
. . .
. . 1
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
650 . 1
. . .
end
label values schoolfees1 w1_nonres
label values schoolfees2 w1_nonres
[/CODE]
Thanks
Nthato
0 Response to Combining Two Similar Variables To be in one row
Post a Comment