Hello
I would like to double sort the firms based on their size (TNA) and their concentration. Therefore, first, I need to sort the firms into terciles based on their size and then sort them based on their concentration. I need then to estimate for each generated portfolio its returns and calculate the difference between tercile 3 and tercile 1
The aim is to obtain the following :
concentration: size :
1-small 2 3-large
1-diversified
2-
3- concentrated
tercile 3- tercile1 x x x
I would like to know if my sas code is correct and to know how can I calculate tercile3-tercile1 and where to insert that in my sas code.Thank youu in advance
proc rank data=doublesort groups=3 out=ranked; by date; var TNA; ranks GROUP_1; run; proc rank data=ranked groups=3 out=rankedfinal; by date var Concentration; ranks GROUP_2; run; proc sort data=rankedfinal; by date GROUP_2 GROUP_1 ;run; PROC UNIVARIATE DATA= rankedfinal noprint; var return; by date GROUP_2 GROUP_1 ; output out= ga3 mean=MOYENNE; run; proc sort data=ga3; by GROUP_2 GROUP_1;run; proc means data = ga3 noprint ; by GROUP_2 GROUP_1 ; var moyenne; output out = rankedfinal1 mean= ewret; run;
You should verify the output of your code using independent method. For example, run your sequential double sort/rank on your test data using excel and then verify that you get the same results with your SAS code. This way you will know for certain that your code is operating as expected.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.