Calcite | Level 5

## Calculate Co-variance and Co-skewness of multi asset portfolio

data WORK.PORT_SAS1;

input acc:BEST12. year:BEST12. month:BEST12. isin:\$12. stockValue:BEST12. sumStockValue:BEST12. ret:32. id_vol:32. id_skew:32. exp_skew:32.;
format acc BEST12. year BEST12. month BEST12. stockValue BEST12. sumStockValue BEST12.;
label ret="ret" id_vol="id_vol" id_skew="id_skew" exp_skew="exp_skew";
datalines;
6464 1996 9 FI0009000053 1516.8 14503.3 0.0070707072 0.014095664 -0.409987509 -0.101588927
6464 1996 9 FI0009000285 2834 14503.3 -0.037383176 0.028269276 -0.125411317 1.0177152157
6464 1996 9 FI0009000202 2572.5 14503.3 0.0054794522 0.0130039575 1.1602475643 0.402938664
6464 1996 9 FI0009000707 7580 14503.3 0.0099009899 0.0219429601 0.5999519825 -0.269438356
6464 1996 10 FI0009000285 2678 15002.2 -0.029990628 0.0273272116 0.3355706632 0.499995023
6464 1996 10 FI0009000202 2569 15002.2 -0.007092199 0.0136819324 0.9428936243 0.3203088343
6464 1996 10 FI0009000707 8160 15002.2 0.0338164233 0.0213803966 0.6024077535 0.128086552
6464 1996 10 FI0009000053 1595.2 15002.2 0 0.0133521734 -0.262459815 0.0332798772
;
run;

Hey,

I have a data set (excerpt above) which includes observations at the investor, stock, month level.

I'm looking to calculate the idiosyncratic vol (ID_Vol), idiosyncratic skewness (ID_Skew) and expected skewness (Exp_Skew) of the portfolios each month.

I have calculated the respective values at the asset level (attached) but I am having difficulties calculating the values at the portfolio level as I'm not calculating co-variance and co-skewness for a multiple asset portfolio correctly.

Thus, how do I calculate the co-variance and co-skewness of the assets such that I can then calculate the respective values for the portfolios?