Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Fwd: How to manipulate crsp data to construct momentum portfolio

 From Robson Glasscock To statalist@hsphsun2.harvard.edu Subject Re: st: Fwd: How to manipulate crsp data to construct momentum portfolio Date Tue, 4 Oct 2011 10:11:12 -0400

```Your explanation is clear, but you haven't said where your problem is.
How far are you able to get before getting stuck?

On Mon, Oct 3, 2011 at 1:08 AM, Tang, Fang <tanglion@gmail.com> wrote:
> Hi, statalist,
>
> This question really bothers me a lot.
> I want to construct 10 momentum portfolios and calculate their monthly
> return.  Part of the monthly data is as follows. At the end of each
> month, I have the data of price(prc), ret(current month return),
> market capitalization for all the stocks--all variables possibly
> missing. My methodology is as follows. At the end of month, I exclude
> all stocks with 1) price< \$5  2) market cap in the smallest 10%
> 3) no missing monthly return for previous 6 months.(Here, I understand
> the sequence of these operations matters, but any choice is fine).
> After this,  I split all the left stocks into 10 deciles based on
> their previous 6 months cumulative return and keep track of these 10
> portfolios to calculate corresponding equally weighted monthly returns
> for the future 6 months. Note some of the stocks may be unlisted in
> the next 6 months so missing values may emerge here. If this happens,
> just reduce the number of stocks contained in each portfolio to
> calculate the equally weighted monthly returns. Lastly, since all
> those portfolios will be held for 6 months, at the end of each month,
> I actually have 6 portfolios available in each decile.One formed right
> now, one formed 1 month ago, one formed 2 months ago, and ....one
> formed 5 months ago. So the real monthly return is equally weighted
> return of those 6 portfolios for each decile. The final output is
> monthly returns for each of the 10 decile portfolio.
>
> I hope I made myself clear enough. Thanks very much
>
> Stanley Tang
>
>      +----------------------------------------------------------------------------------------------------------------------+
>      |       date   year   month      cusip   ticker   permno   permco
>   shrout       prc        ret        time        cap |
>      |----------------------------------------------------------------------------------------------------------------------|
>   1. | 01/31/1964   1964       1   04559140      AOE    29233    23606
>       16    5.6875   -.031915   31jan1964         91 |
>   2. | 01/31/1964   1964       1   91102630      UMO    37647    24250
>       16   5.71875   -.056701   31jan1964       91.5 |
>   3. | 01/31/1964   1964       1   25474130      DIL    31245    23763
>       51   3.59375   -.128788   31jan1964   183.2813 |
>   4. | 01/31/1964   1964       1   74099090      PMW    39001    24352
>      415    .53125      .0625   31jan1964   220.4688 |
>   5. | 01/31/1964   1964       1   36959520      GLE    32168    23832
>       26      9.25   -.130667   31jan1964      240.5 |
>      |----------------------------------------------------------------------------------------------------------------------|
>   6. | 01/31/1964   1964       1   14444770      CRL    30373    23700
>      318    .78125   -.074074   31jan1964   248.4375 |
>   7. | 01/31/1964   1964       1   88880320      TSU    37372    24225
>       97      2.75   -.083333   31jan1964     266.75 |
>   8. | 01/31/1964   1964       1   88880330      TSU    37380    24225
>       34    7.9375    .024194   31jan1964    269.875 |
>   9. | 01/31/1964   1964       1   04999290      ASW    29364    23616
>      890      .375          0   31jan1964     333.75 |
>  10. | 01/31/1964   1964       1   95969010      WSI    38017    24279
>      677        .5          0   31jan1964      338.5 |
>      +----------------------------------------------------------------------------------------------------------------------+
>
> *
> *   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/
```