Good morning, @rotmo86, and welcome to the SAS Support Communities!
The error messages must be due to something you submitted before the code shown in the screenshot. I see two issues with the macro:
Remember that the DATA step code created by the macro processor is executed only after the macro processor has finished its work. This implies that values of variables read by the DATA step cannot be used by the macro processor. Therefore the %DO %WHILE ... %END loop starting with
%do %while (date<="&end_date"d);
should have remained a DO WHILE loop: It's the value of variable date which is to be compared to the "&end_date"d (in the DATA step), not the four-letter text date (which the macro processor sees).
When macro parameter &mylib resolves to BaseDeDades_, the DATA step will interpret this as a variable name. So, either use quotes around BaseDeDades_ in the macro call (as you did in the %LET statement in line 3) or add double quotes in the macro:
new_var= "&mylib" || put(date,YYMMN6.);
These corrections should resolve the issues. Start a new SAS session if leftovers from a previous failed macro call continue to produce errors in the log.
... View more