BookmarkSubscribeRSS Feed
jaxonmills
Calcite | Level 5

Let's say I have the following data on firm size, profitability, and stock returns. The firms are sorted into terciles according to size and profitability like so:

ObsSize_TercileProfitability_TercileStock_Return
111.12
211.03
312.21
412.37
513.14
613.07
721.19
822.17
922.06
1022.11
1123.42
1223-.13
1331.03
1431.05
1532.22
1633-.16
............

What's the most efficient way to program a double sort? I want to get average returns for the intersection of each size tercile with each profitability tercile:


Average Stock Returns sorted by firm size and profitability


Profitability Terciles <->
Size Terciles \/ \/123
1.........
2.........
3.........

I'm looking for efficiency here because this process will be repeated for several different variables sorted not necessarily by just terciles. Thanks in advance.

2 REPLIES 2
LinusH
Tourmaline | Level 20

I'm not sure if I got the picture clear, but PROC SUMMARY using CLASS is usually very efficient.

/Linus

Data never sleeps
yotsuba88
Quartz | Level 8

Hi Jaxonmills,

 

Have you solve this problem? Please share with me, I am working on it now but I havenot found the solution for it.

 

Thank you very much.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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