Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "M@rk " <krap_m@hotmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Re: Portfolio returns per month, drop return duplicates |
Date | Mon, 25 Nov 2013 17:34:24 +0100 |
Dear Nick,I checked it afterwards and no data has been lost when using 'force'. I still have 1,044 observations, which is 87 years (1926-2012) times 12 months. I also checked whether the return figures are still the same for each month after using this command and this is the case.
Kind Regards, Mark-----Oorspronkelijk bericht----- From: Nick Cox
Sent: Monday, November 25, 2013 2:29 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: Re: Portfolio returns per month, drop return duplicates Bad idea, probably. I am responsible here in so far the -force- option is part of what -duplicates- provides and I am the putative author of -duplicates-. But -force- is there as brute force to be used if and only if you are sure what you want. Here what you should want is to remove duplicates on each month and therefore on any variable with the same value for each month. So, I suspect you lost information doing that. Nick njcoxstata@gmail.com On 25 November 2013 13:06, M@rk <krap_m@hotmail.com> wrote:
Dear Nick, Thanks for your quick reply. I tried the command: 'duplicates drop PRB1, force' and it worked as far as I know. Kind Regards, Mark Krap -----Oorspronkelijk bericht----- From: Nick Cox Sent: Monday, November 25, 2013 1:39 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: Portfolio returns per month, drop return duplicates -duplicates- should work here if I understand your problem. Otherwise consider -egen-'s -tag()- function and keeping only tagged observations. Nick njcoxstata@gmail.com On 25 November 2013 12:27, M@rk <krap_m@hotmail.com> 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 foreach stock observation in a month. So if the total of the weighted returnsis, 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 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/
* * 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/