Execute SQL Server Agent Jobs Using SAS
There may be occasions where it is necessary to execute a SQL server agent job from SAS. Before this can be achieved, the following prerequisites need to be met:
• Either the osql or sqlcmd utility must be available on the machine from where the SAS program will be executed
• The ability to utilise X command via SAS must be enabled
The above utilities provide the ability to perform SQL Server operations through the operating system command line, including the execution of SQL Server Agent jobs. The utilities use ODBC to communicate with the SQL server specified.
Once the selected utility has been installed, it can now be invoked via SAS X command. For this example, we are using the osql utility:
Running through the arguments called: