I have a macro like this:
%macro loop(report_date);
/* some sql-code with where-statement on report_date:
create table with name small_table */
%mend;
Then I want to write a code which creates a table: this table is union of tables where the condition on the varible report_day is true. But my code doesn't work:
%let days_number = 31;
%let Min_Date = '01Jan2018:00:00:00'dt;
/* create table with name big_table */
/*this macro creates a union table */
%macro doInLoop(report_date);
%loop(&report_date.);
PROC SQL;
CREATE TABLE Big_table AS
SELECT *
FROM big_table
UNION ALL
SELECT *
FROM small_table;
QUIT;
%mend;
%macro createTable;
%local j;
%do j = 1 to &days_number.;
%let rep_date = dhms(datepart(&Min_Date.) + j, 0, 0, 0);
%if day(rep_date) = 1 %then %doInLoop(%rep_date);
%end;
%mend;
%createTable;
I have 31 mistakes with messages: "ERROR: The following columns were not found in the contributing tables: j"
Or how can I create a macro, that uses a working macro for one day ("loop"), for certain days from the range?
Thank you.