Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: RE: collapse with mode


From   Tyler Frazier <tyfrazier@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: collapse with mode
Date   Tue, 1 Jun 2010 00:32:26 +0200

thanks for the suggestion, I need to think this through a bit

On Tue, Jun 1, 2010 at 12:15 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
> You can still -egen-erate the mode beforehand, and retain the first
> observation during the -collapse- call:
>
>
> ***********
> sysuse auto, clear
> bys rep78: egen mymode=mode(foreign)
> collapse (firstnm) mymode, by(rep78)
> l
> ***********
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tyler Frazier
> Sent: Dienstag, 1. Juni 2010 00:08
> To: statalist@hsphsun2.harvard.edu
> Subject: st: collapse with mode
>
> Is there a way to execute a collapse and return the mode of a variable
>
> I have a variable which is either 11 , 21  or   51  (land use:
> residential, commercial or public) which can possibly but not likely
> change over the time period
>
> I want to collapse the average consumption to the meter for the time
> period (16 months), but then retain either the mode or some indication
> that the meter land use has changed its land use during this time
> period
>
> Is there a way to do this?
>
> Thanks,
> Ty
> *
> *   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/
>
> *
> *   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/
>

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