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

Re: st: collapse


From   David Kantor <dkantor@jhu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: collapse
Date   Mon, 23 Feb 2004 16:08:19 -0500

Try
egen newvar = mode(oldvar), by(groupvars)

Then reduce to one observation per groupvars.

Note that there are some options on -egen...mode-, which you may want to look into.
See -help egen-.

I also have an alternative mode function (regarding how it handles ties); write me privately if you want to have it.

-- David.

At 03:36 PM 2/23/2004 -0500, Adrian wrote:

Dear Stata friends,

I am trying to collapse some variables using the MODE as my descriptive
statistic, but I see that -collapse- doesn't allow this. Any thoughts?

Thank you.
Adrian
[...]
David Kantor
Institute for Policy Studies
Johns Hopkins University
dkantor@jhu.edu
410-516-5404

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index