[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: combining two variables
hi all-
i have a data structure question, and i could use some advice.
suppose i have two variables say a_school and b_school. the values of
these two variables are either the same, or one of the two might
be missing. i would like to somehow merge these into a single variable-
say c_school.
if i only had to do this once, it would be quite simple.
gen c_school=b_school
replace c_school=a_school if c_school==.
done.
however, i have to do this repeatedly. as in... i have many of these
pairs. a_size, b_size... a_score, b_score...etc.
i have been trying to figure out a way to do this with the foreach command.
but it doesn't seem to be working out.
does anyone have any suggestions?
any help would be appreciated.
daphna
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/