Hi all,
I'm replicating JT's (2001, JF) 'momentum' strategy and meet a problem about how to exclude stocks with price less than 5. Because this strategy is monthly rebalaced, the problem seems much more complicated than that if portfolio is nonoverlapping. I attached the paper (See P702-703)
There are N stocks in a dataset. For example, stock A's price is 6 at time t, 4 at t+1, 5.5 at t+2, 4.8 at t+3 ...
Time Stock Price Return
1985/01 A 6 given
1985/02 A 4
1985/03 A 5.5
1985/04 A 4.8
1985/01 B 6.2
1985/02 B 5.1
1985/03 B 4.8
1985/04 B 6
1985/01 C 23
1985/02 C 19
1985/03 C 20
1985/04 C 22
........
I know how to calculate the avearge monthly returns rebalanced monthly if no more condition is required. However, now we want to exclude all stocks priced below $5 at the begining of holding period (e.g., when the begining of the holding period is 1985/01, stock A,B,C's prices are above 5, so they are included in portfolio; for 1985/02, only stock B and C are in portfolio, for 1985/03, A and C, and so on). If the holding period is 3 months, for 1985/04, the rebalanced average monthly return is 1/3(1985/04-02)+1/3(1985/03-1985/01)+1/3(1985/02-1984/12).
If we just use codes 'if price<=5 then delete' at the begining, the result is different from JT(2001), though I got the similar result when I replicate JT (1993) without such price condition. How to construct such monthly rebalanced dataset if condition about price is added?
Thanks
data test;
input Time:$7. Stock:$1. Price ;
datalines;
1985/01 A 6
1985/02 A 4
1985/03 A 5.5
1985/04 A 4.8
1985/01 B 6.2
1985/02 B 5.1
1985/03 B 4.8
1985/04 B 6
1985/01 C 23
1985/02 C 19
1985/03 C 20
1985/04 C 22
;
run;
proc sql;
create table want as
select * from test
where stock not in (select distinct stock from test
where price <= 5);
quit;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.