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

st: Re: collapse


From   "R.E. De Hoyos" <redeho2@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: collapse
Date   Mon, 23 Feb 2004 21:30:00 -0000

you might want to try:

by id: egen VarM = mode(x)

collapse VarM, by (id) 

 It will give you the mode within each id.  

rafa

----- Original Message ----- 
From: "de la Garza, Adrian" <ADelagarza@imf.org>
To: <statalist@hsphsun2.harvard.edu>
Sent: Monday, February 23, 2004 8:36 PM
Subject: st: collapse


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