Hey, Guys, I am really new to SAS, and trying to learn. But now I got stuck with this problem. Hopefully you can help me out of it. For each stock, I get holding shares from different funds (holding funds numbers may vary). Now I have summed all the holdings of all funds, but now I want to calculate the holding shares of top one/two/three/whatever funds in terms of the shares they hold. Any idea how to realize this? Thx in advance. Laoban Thanks, guys, the data is quite big, so I will just post some man-made data. I think this will be enough. Stock Fund Share A alpha 60 A beta 33 A gamma 12 B alpha 88 B gamma 90 C ita 13 So sorry for my poor English, so basically what I want is. I want to get the holding shares of the top one fund holding for a specific stock: A - 60, B - 90, C - 13. or the top two funds' holding: A - 93, B - 178, C - 13 or NA for this case. ---------------------------------------------------------------- Thank you all. I somehow get some idea how to do that. But still I cannot modify your answers to my final goal. My data set is like: year month stock fund share 1988 3 A alpha 10 1988 3 A beta 33 1988 3 A gamma 12 1988 3 B alpha 28 1988 3 B gamma 90 1988 3 C ita 13 1988 6 A alpha 60 1988 6 A beta 53 1988 6 A gamma 13 1988 6 B alpha 86 1988 6 B gamma 90 1988 3 C ita 13 so my final output desired is like: year month stock first-fund first-fund-share second-fund second-fund-share first-two-fund-share 1988 3 A beta 33 gamma 12 45 ..... ..... ..... I used the following code: proc means data=raw noprint; class stock year month; types () stock year month; var SHARES; output out=top10list(rename=(_freq_=Numberfunds))sum= mean= idgroup( max(SHARES) out[10] (SHARES FUNDNO stock year month)=)/autolabel autoname; run; But it does not give me the fund holding for different years and months separately. Unhappy...-^-
... View more