One way to do this is to -reshape-,
apply -egen, mode()- and then -reshape-
back.
Nick
[email protected]
Oberschachtsiek Dirk
> I am working on a dataset that provides several variables on
> some attributes (e.g. date of birth). Moreover, this dataset
> may provide more than one observation per person, too. Thus
> the dataset holds multiple information for each attribute.
> However, these attributes are not constant within varlist
> and/or by observations - and there is no evidence which is
> the best information to use.
>
> A way out of this is to use the -mode- of varlist by
> observation as the "true" value. Is it possible to solve this
> by using - egen- [like -bysort id: egen sex = rmode(varlist)-
> which is not implemented in stata] or is there any other way
> to get out of this in stata?
>
> Example
>
> Nr. Id var1 var2 var3 outcome_var
>
> obs1 A 2 1 1 2
> obs2 A 2 2 2 2
> obs3 B 2 2 2 2
> obs4 C 1 1 2 1
> obs5 D 1 1 2 1
> obs6 D 2 1 1 1
>
*
* 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/