Also you say "group by three years" but 17 to 20 is 4: 17, 18, 19 and 20.
A common way to handle such groups in use a custom format and apply the format in the procedures that are used to count things.
data have;
input Age Users;
datalines;
17 1
18 2
19 5
20 3
21 9
22 9
23 2
24 5
25 3
26 2
;
proc format;
value myagegrp
17-20 = '17 to 20'
21-23 = '21 to 23'
24-26 = '24 to 26'
;
proc freq data=have;
tables age;
format age myagegrp.;
weight users;
run;
A very strong advantage of using this format approach is that you can create multiple formats that are used with the same data as needed.
The groups created by proc format will be honored by report procedures like Report and Tabulate, and most graphing and analysis procedures.