Mike, Thank you very much. Your answer is very helpful and with some quick testing, it appears to be what I need. To accommodate 20 buckets, instead of 10 buckets, I modified this line: From: rage = input(put(age,ranks.),1.); To: rage = input(put(age,ranks.),10.); Since I am relatively weak in writing sql code, I have an additional question. I need to use a "by" variable in my proc rank. My dataset_a contains 4 different segments and I use a macro variable called &segment_var to delineate them. I then use proc rank and the "by" variable to create 20 ranks (or buckets) for each segment. Is there any way for me to modify your sql code to account for the different ranks within each segment? Thanks, again.
... View more