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: mean calculation & exclusion of certain observations
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: mean calculation & exclusion of certain observations
Date
Wed, 22 Jan 2014 09:38:45 +0100
On Tue, Jan 21, 2014 at 11:29 PM, Loew, Philipp wrote:
> I try to calculate a mean stock price by industry sectors and would like to exclude specific observations.
> The mean should include only the most recent price of each company which is part of the sector and the mean should be calculated
> in a certain range (e.g., 30 days). The observations in the dataset are irregularly spaced.
I suspect you are looking for the -rolling- command. If you first
specify -tsset sector date-, -rolling- will work within each sector.
Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/