BookmarkSubscribeRSS Feed
bera00
Obsidian | Level 7

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;

 

 

1 REPLY 1
donbrockhate
Calcite | Level 5

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.  

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

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.

Discussion stats
  • 1 reply
  • 1775 views
  • 0 likes
  • 2 in conversation