Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: joining variables


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: joining variables
Date   Wed, 19 Feb 2003 21:30:01 +0000

At 21:08 19/02/03 +0000, Sophie Barthel wrote:

Dear List

I have got the following problem:

From a set of observations I have created a variable to10la for people
whose left eye was measured and a variable to10ra for people whose right
eye was measured. Whenever a person appears in the data whose right eye
was measured to10la displays a missing value and vice versa. All of
these are meant to be merged into one variable, however I do not seem to
be able to find out how to do this.
I assume that nobody has both eyes measured.You might type

gene to10a=.
replace to10a=to10la if !missing(to10la)
replace to10a=to10ra if !missing(to10ra)

and the new variable to10a will be equal to to10ra for people whose right eye was measured, and equal to to10la for people whose right eye was not measured and whose left eye was measured, and missing for people for whom neither eye was measured. (People whose eyes were both measured will have t010a equal to the right eye value.)

I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

Opinions expressed are those of the author, not the institution.

*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index