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]
Re: st: Assign highest value per group to all members of that group
From
Richard Goldstein <[email protected]>
To
[email protected]
Subject
Re: st: Assign highest value per group to all members of that group
Date
Fri, 04 Feb 2011 13:11:45 -0500
try this:
egen maxX=max(X), by(G)
Rich
On 2/4/11 12:56 PM, Owen Corrigan wrote:
> My data contains individual observations (taking a value 0-8 on indep
> variable X) divided into small unequal groups, where each group is
> uniquely identified by a grouping variable (G). I want to identify the
> highest value on X in each group uniquely identified by G and generate
> a new variable assigning that value to all members of that group. It
> should be a simple task, but standard data manipulation commands don't
> seem up to it, and I'm not versed in writing code or loops in Stata.
>
> Any quick and simple solutions greatly appreciated.
>
> Yours,
> O. Corrigan
> University of Dublin.
*
* 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/