Search code examples
sassas-macro

Writing a macro in SAS to create a table


Very new to SAS Programming. Want to start with something simple - writing a macro that run an append query. This is all I have managed to figure out. Where am I going wrong?

%MACRO APPENDTEST;
    PROC SQL;
        CREATE TABLE WORK.APPENDTEST AS
        SELECT *
        FROM WORK.MONTHLY_SALES_SUMMARY
    QUIT;
%MEND APPENDTEST;

Solution

  • You've created a macro but have executed it. This functionality, similar to a function in other languages, allows a macro to compile and execute and different times.

    Adding in the following line will call the macro.

    %appendtest;