|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Generating mean by two groups
From
"Alan Neustadtl" <[email protected]>
To
[email protected]
Subject
Re: st: Generating mean by two groups
Date
Tue, 9 Jan 2007 18:46:30 -0500
The following should work:
bysort L D: egen M=mean(P)
Best,
Alan
On 1/9/07, Z. Aloha <[email protected]> wrote:
Hi,
How can I generate a mean by two groups. That is I have different
location allocations (L) and different dates (D), and I would like to
generate a new variable (M) that contains the mean of the price (P)
within each location on each date. An example is listed below:
P L D M
1 A 1 1.5
2 A 1 1.5
3 B 1 3
3 B 1 3
5 A 2 5.5
6 A 2 5.5
3 B 2 5
7 B 2 5
2 A 3 3.5
5 A 3 3.5
4 B 3 6
8 B 3 6
12 A 4 8
4 A 4 8
6 B 4 4
2 B 4 4
*
* 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 |