Line for the server...
Sounds like a problem for -h rolling-
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ashim Kapoor
Sent: Friday, November 21, 2008 8:11 AM
To: [email protected]
Subject: st: running collapse
Hello everyone,
I wish to create a " running collapse" . I wonder if this is even the
right command to do this. Here is what I want :-
I have a dataset
Month Returns
1 .5
1 .6
1 .7
2 etc
2
2
3
3
3
4
4
4
5
5
5
6 1
6
6
So the command:
collapse (mean) returns, by (month) would generate the mean monthly returns.
But suppose now I want 2 monthly returns so for February I want the
mean over Jan and Feb, for March I would want the mean over Feb and
March etc.
Now I can do : --
sort month
egen j=group(month)
replace j=j-1 if mod(j,2)==0
THIS DOES group 2 months together but it does not give me a "running
group". For example Jan - Feb would be one group and the next one will
be Mar-April instead of being Feb-Mar.
Has someone dealt with this ?
Thank you,
Ashim.
*
* 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/