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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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