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]
st: Creating ten 10%-portfolios
From
Bo Spiljard <[email protected]>
To
[email protected]
Subject
st: Creating ten 10%-portfolios
Date
Fri, 1 Mar 2013 17:00:38 +0100
Dear Statalist,
I am busy making my master thesis for Finance and I am stuck on
something that looked so easy to do. I am testing a version of the
CAPM and I need to make ten 10-percentile portfolios (sub groups) and
these have to be revised each month. This has to be done by creating a
new variable that contains the numbers 1 to 10 and each number should
represent a portfolio.
Normally if I am stuck I could find the answer by searching on
statalist, but this problem I could not find. I allready tried alot of
things myself (i.e. using r(p10)) etc, but I cannot find the right
code. The data I have is: id, date (year, month and day), and illiq. I
need to create 10 equal portfolios based on the proportion of illiq
and this have to be revised each month. So each of the portfolio at
each month has to contain the same amount of ids, with in portfolio 1
the id with the lowest value of illiq, in portfolio 2 the id with
slightly higher illiq, etc..
Also the data for each firm does not start and not end at the same
date and also for each date there is missing information, so I cannot
purely use the sort function.
Here is an simplified example with allready portfolios added how it
should look like.
id year month day illiq portfolio
1 2001 1 1 15 3
2 2001 1 1 13 2
3 2001 1 1 12 1
1 2001 1 2 11 3
2 2001 1 2 8 2
3 2001 1 2 13 1
...
1 2001 2 1 10 3
2 2001 2 1 9 2
3 2001 2 1 7 1
...
1 2009 12 31 8 1
2 2009 12 31 11 2
3 2009 12 31 13 3
I hope there is someone can help me with this, cause I need this to go
to the next step.
Kind regards,
Bo
*
* 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/