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

st: How to get the mode within varlist


From   Oberschachtsiek Dirk <[email protected]>
To   [email protected]
Subject   st: How to get the mode within varlist
Date   Mon, 7 Feb 2005 18:09:56 +0100

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


Dirk Oberschachtsiek
*
*   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