Yes, but I suspect you are trying to get year-specific deciles - at least that's what is typical here. So if you have a DATE variable then: proc univariate data=nyse noprint; var at; class date ; format date year4.; output out=nyse_brkpoints pctlpts=0 to 100 by 10 pctlpre=PCTL_ /* vars to be named pctl_0 pctl_10 ... pctl_100 */ ; run; ** So in the above you created one row per year. Below put each of those rows in a row of the CATS matrix. Assuming you have no data prior to 1980 and none after 2010, I bounded the row dimension of CATS to 1980:2010. data want (drop=pctl_:); ** First populate the CATS matrix **; if _n_=1 then do until (end_of_pctl); set brkpoints end=end_of_pctl; array pcts {1:10} pctl_0 -- pctl_90; array cats {1980:2010,1:10} _temporary_; year=year(date); do C=1 to 10; cats{year,C}=pcts{C};end; end; ** Now select a row in CATs to determine deciles for records in MYDATA set mydata; year=year(date); ** use this YEAR value to go to desired row of CATS **; if not (missing(at)) then do decile=10 to 1 by -1 until (at>=cats{year,decile}); end; run; BTW, often you want to use last year's deciles to categorize this years' companies (numerous investment strategies do this). If so, then change the UNTIL expression to: until (at>cats(year-1,decile)) Of course this only works if the calibration dataset has data in the year preceding the earliest year in MYDATA. Then go ahead and make means for DECILE*YEAR or DECILE*DATE (formatted at year4.). As to averages,
... View more