To create a macro named deptdisplay, for example, that includes the following BTEQ SEPARATOR command and SQL SELECT statement:
.SET SEPARATOR ' | ' SELECT * FROM department;
CREATE MACRO deptdisplay AS ( ECHO '.SET SEPARATOR '' | '' ' ;SELECT * FROM department; );
When enclosing single quotes within quotes, double the inner quotes so that each inner, single quote becomes two single quotes.
After creating the macro, BTEQ displays:
*** Macro has been created. *** Total elapsed time was 3 seconds.
Develop more complex macros by placing them in a file and running the file in a BTEQ batch job.