How does PROC SQL work?

PROC SQL is nothing but a simultaneous process for all the observations. The following steps occur when a PROC SQL gets executed:

  • SAS scans each and every statement in the SQL procedure and checks the syntax errors.
  • The SQL optimizer scans the query inside the statement. So, the SQL optimizer basically decides how the SQL query should be executed in order to minimize the runtime.
  • If there are any tables in the FROM statement, then they are loaded into the data engine where they can then be accessed in the memory.
  • Codes and Calculations are executed.
  • The Final Table is created in the memory.
  • The Final Table is sent to the output table described in the SQL statement.