I don't know nothing about sas, but i have impression that sas is more of upper level solution which is able to generate query via sas/access against databases (something like Linq, if u don't know, forget it). correct me if i'm wrong.(but don't do it, i'll kill u~~)
u don't have control what the execution plan(if there's any?if u don't know that's fine) the query could use and u don't have control indexes that's pretty much tailor made upon particular query.
however i'm pretty sure db guys can help u with ur optimization of query as the ultimate data is get stored in database.
just wild guess, creating proper index might be possible solution u can look into if help is available from dba of databases