Help using Base SAS procedures

Most efficient way to program double sort?

Reply
New Contributor
Posts: 4

Most efficient way to program double sort?

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.

Super User
Posts: 5,257

Most efficient way to program double sort?

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

/Linus

Data never sleeps
Contributor
Posts: 39

Re: Most efficient way to program double sort?

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.

Ask a Question
Discussion stats
  • 2 replies
  • 565 views
  • 0 likes
  • 3 in conversation