Hi Daniele
In the end-of-the-day also the data step approach results in some SQL code sent to the SQL server.
To see what code is sent to SQL and executed there the following options can be helpful:
options sastrace=',,,ds' sastraceloc=saslog nostsuffix;
The most time consuming part will be I/O. It also depends if you load the whole table or only a part into SAS. If it's only a part of the table then make sure that the selection is done on the SQL side - and do not download the data first to SAS and then select. - The options I've sent you will tell you if SAS is handling things.
It often helps to avoid SAS specific functions for data selection - as SAS often can't resolve such functions into SQL statements (and therefore selects only later).
HTH
Patrick
P.S: I know that there are quite a bit of SAS papers about performance. Just too lazy right now to do this search job for you 😉
... View more