BookmarkSubscribeRSS Feed
MarthelF
Calcite | Level 5

Hey Dear members, 

 

I'd like to construct with my Data sets in the Attachments 10 equally weighted decile Portfolios, which are ranked on the past 3 year volatility. what i've done yet is to rank and create a colomn on  my data named volatility like you can see on my SAS Code. But the data inside are again the data from my Excel that mean from LogReturn, so my Question now is how to calcul the volatility of each firm and rank all this result on the past 3 year volatility by generating 10 equally weighted Decile Portfolios. Thanks for your Help in Advance!

FILENAME REFFILE '/folders/myshortcuts/MyFolders/SaS_Stoxx300.xlsx';
PROC IMPORT DATAFILE=REFFILE
  DBMS=XLSX
  OUT=WORK.IMPORT
  replace;
  GETNAMES=yes;
  SHEET="LogReturn";
  RANGE='a3:zz99999999999'n;
RUN;

proc sort data=work.import(keep=_numeric_);
  by date;
run;

proc transpose 
      data=work.import  
      out=work.transposed(rename=(_label_=Firm Volatility1=Volatility) where=(not missing(Volatility)) drop=_name_)
      prefix=Volatility;
  by date;
run;

proc rank data=work.transposed groups=10 descending out=work.ranked;
  var Volatility;
  ranks Decile;
  by date;
run;

proc sort data=work.ranked;
  by date decile;
run;

proc print data=work.ranked;
  by date;
run;

 

3 REPLIES 3
Ksharp
Super User

How do you define 'equally weighted decile portfolios' ?

Do these portfolios have the same expect return (  mean(return) ) or the same variance ( var(return) )?

MarthelF
Calcite | Level 5

Hi Ksharp, to come back on your Question , i understand now what you mean, on my Excel data we have the LogReturn, the second  step should be to calculate the volatility of all this data, then use a Code to sort all the data into equally weighted decile Portfolio, that means on my example with 303 firms , after sorting we'll  have 10x30  and  each decile will have 30 Firms having data of volatility. i have added the Excel data in the Attachments to Show you how my data will look for after sorting. PS:  the data inside my tables are not correct just selected for me like example.  

MarthelF
Calcite | Level 5
Hi Ksharp,
It means that the excess return are quite fast the same after sorting but the data are sorted on variance( Volatility).thanks!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1642 views
  • 0 likes
  • 2 in conversation