You specify the VALIDATE keyword just
before a SELECT statement; it is not used with any other PROC SQL
statement.
We will modify the preceding
PROC SQL query by using the VALIDATE keyword instead of the NOEXEC
option:
proc sql;
validate
select empid, jobcode, salary
from sasuser.payrollmaster
where jobcode contains 'NA'
order by salary;
Note: Note that the VALIDATE keyword
is not followed by a semicolon.
If the query is valid,
the SAS log displays the following message.
Table 2.6 SAS Log
NOTE: PROC
SQL statement has valid syntax.
|
If there are errors
in the query, SAS displays the standard error messages in the log.
The main difference
between the VALIDATE keyword and the NOEXEC option is that the VALIDATE
keyword only affects the SELECT statement that immediately follows
it, whereas the NOEXEC option applies to all queries in the PROC SQL
step. If you are working with a PROC SQL query that contains multiple
SELECT statements, the VALIDATE keyword must be specified before each
SELECT statement that you want to check.