Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: how to generate row mode


From   "Fernando H. Andrade" <[email protected]>
To   [email protected]
Subject   st: how to generate row mode
Date   Wed, 23 Jan 2008 10:12:47 -0500

Hello

I am trying to compute the equivalent to a rowmode, a function similar to rowmean in the egen command. i think the ado for a rowmode function (which may compute the mode across several variables) does not exist, does it? as an alternative i thought to reshape the data and collapse it using the mode but the mode is not a function to collapse the data.
is there a way to compute the mode across a set of variables for each subject?

to be more concrete:
this is the structure of the data

subject p1 p2 p3
1 2 2 4
2 1 1 3
3 2 2 4
4 1 1 1
5 3 4 4

i would like to generate a new variable containing the mode across p1 to p3 for each one of the subjects such that for subject 1 the generated value would be 2, and 1, 2, 1,4 for subjects 2,3,4,5 respectively.

thank you very much for your time and attention

Fernando






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