BookmarkSubscribeRSS Feed
hellohere
Pyrite | Level 9
Say here are 10 Winner and 10 Loser Portfolio(with 20 daily performances, see the data below). 
How to find the optimal WIN-LOSE portfolio pair with the maximum RET/stdev [ret=ret_win-ret_lose]?!
Anyway to find the optimal with ret (historical ret as expected ret) and correlation matrix,
rather than go through emulation?! data _port_win_expt_ret; do i=1 to 10; do tradingday=1 to 20; ret=100+2*ranuni(i); output; end; end; run;quit; data _port_lose_expt_ret; do i=1 to 10; do tradingday=1 to 20; ret=100-1.5*ranuni(i); output; end; end; run;quit; proc sort data=_port_win_expt_ret;by tradingday i; run;quit; proc transpose data=_port_win_expt_ret out=_port_win_expt_ret_t(drop=_NAME_) prefix=ret_W_; by tradingday; var ret; id i; run;quit; proc sort data=_port_lose_expt_ret;by tradingday i; run;quit; proc transpose data=_port_lose_expt_ret out=_port_lose_expt_ret_t(drop=_NAME_) prefix=ret_L_; by tradingday; var ret; id i; run;quit; proc sql; create table _port_WL_ as select a.*, b.* from _port_win_expt_ret_t as a left join _port_lose_expt_ret_t as b on a.tradingday=b.tradingday order by a.tradingday; quit; proc corr data= _port_WL_ out= _port_WL_corr; run;quit;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 0 replies
  • 497 views
  • 0 likes
  • 1 in conversation