Tell us your rules, and we'll suggest some code.
Nick
[email protected]
Moore, Jesse
> Will this work for more than two variables? I'm working with
> a similar
> situation, but with 7 variables.
Nick Cox
> Some very complicated solutions here!
>
> Consider:
>
> gen newvar = max(var1, var2) if missing(var1, var2)
>
> Logic:
>
> If just one of var1 or var2 is missing,
> then -missing()- will return true.
>
> In that case, max(var1, var2) will
> return the non-missing value in question.
>
> If both are missing, then you get missing returned,
> but that is fair enough.
>
> If neither is missing, missing is returned.
*
* 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/