Bookmark and Share

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: Re: Portfolio returns per month, drop return duplicates


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Re: Portfolio returns per month, drop return duplicates
Date   Tue, 26 Nov 2013 12:24:58 +0000

The help for -collapse- does make it clear that you can -collapse-
several variables at once.

Nick
[email protected]


On 26 November 2013 10:14, M@rk <[email protected]> wrote:
> Thanks for the replies! @ Nick: I now have the data that I need to proceed.
> Its probably not the way to delete duplicates, but it worked for me.
> @Sergiy: Collapse works, but I have multiple portfolios. Not only PRB1, but
> als PRB2, PRB3 etcetera (120 portfolios).  It uses mean values, which is no
> problem as the return figures in a month are the same for each observation.
> Can I combine multiple portfolios (/variables) when using this command? Or
> is it only applicable for 1 variable?
>
> Kind Regards,
>
> Mark Krap
>
> -----Oorspronkelijk bericht----- From: Sergiy Radyakin
> Sent: Monday, November 25, 2013 5:52 PM
>
> To: [email protected]
> Subject: Re: st: Portfolio returns per month, drop return duplicates
>
> On Mon, Nov 25, 2013 at 7:27 AM, M@rk <[email protected]> wrote:
>>
>> Dear Users,
>>
>> For my research I need to have portfolio returns for each month from 1926
>> till 2012. I already calculated the weighted returns for each portfolio
>> and
>> summed them up (by date) by creating a  new variable (PRB1). The only
>> problem is that this sum is not given once for each month, but is given
>> for
>> each stock observation in a month. So if the total of the weighted returns
>> is, let's say, 0.026 in March 2006 its mentioned for each stock
>> observation
>> in March 2006. I tried to downsize this by using the duplicates drop [in]
>> command, but I get the error message 'invalid obs no'. Does anyone know
>> how
>> I can get the portfolio returns once per month, as for my research I only
>
>
> Besides what Nick has already suggested:
>
> #1
> sort year month
> by year month: keep if _n==1
>
> #2
> sort year month
> collapse PRB1, by(year month)
>
> note that you need year unless your month is cmc.
>
>
> In the command that you quoted "duplicates drop PRB1" you are relying
> on a random fact that your portfolio returns would vary uniquely by
> time, which is commonly true, but not necessary (e.g. in the period of
> stability you could have returns for e.g. 3 months being same).You
> should seek duplicates in terms of time, not values!
>
> Best, Sergiy
>
>
>> need portfolio returns per month from 1926 till 2012 in order to do the
>> regressions. I am using Stata 12 SE (Windows 7 64-bit).
>>
>> I look forward to the reactions.
>>
>>
>> Kind Regards,
>>
>> Mark Krap
>>
>> *
>> *   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/
>
> *
> *   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/
> *
> *   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index