1) capture SAS-reserved variable _N_ as OBSNUM for highest location identification.
2) use PROC SUMMARY to generate a _FREQ_ count. Specify ID OBSNUM to get the last occurence.
3) use SORT with BY DESCENDING _FREQ_ DESCENDING OBSNUM.
If the table is too large to process (sort, dedup, summarise) as suggested above,
you can read it starting from the end:
if 0 then set SASHELP.CLASS nobs=NOBS;
do I= NOBS to 1 by -1;
set SASHELP.CLASS point=I;
You can add some logic in the data step to do what you want, like filling up an array with unique values as you go.