Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Compute Modus accross variablesCompute Modus accross variables


From   Christian Hunkler <[email protected]>
To   [email protected]
Subject   st: Compute Modus accross variablesCompute Modus accross variables
Date   Sat, 04 Dec 2010 16:41:28 +0100

I am looking for a command / ado that allows to compute the mode accross variables, possibly also for strings.

E.g. if  I had these data:

id     var1      var2       var3
1     1991     1992     1991
2     1960     1961     1961
3     1920     1920     1921

I would like to compute a variable storing the mode across lines:
id     mode
1     1991
2     1961
3     1920

I know this can easily done by some simple reshaping using -egen mode by- collapsing and merging the data again, but we deal with pretty large datasets (reshaping takes minutes) and we have to do this for a couple of variables. And we have to do this for variables storing names (which is possible with -egen mode by-).

Maybe there is something available to do this, I haven't found yet?

Thanks

--
Christian Hunkler

University of Mannheim, 68131 Mannheim, Germany
 Chair for Sociological Theory, http://www.sowi.uni-mannheim.de/lssw, +49(0)621/181-2024 Phone |-2021 Fax |-2022 Secretary
 MEA - Mannheim Research Institute for the Economics of Aging, http://www.mea.uni-mannheim.de, +49(0)621/181-3343 Phone |-1863 Fax


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index