Semicolons are not required for macro calls.
Often they are included as people are used to seeing semicolons as a way of "terminating the statement" or ending the line. I personally prefer to include them when possible as I believe it makes my code more readable.
Remember that macros simply evaluate themselves and return whatever it is that they resolve to which could be a block of code that looks like a number, a string, or anything else...
Take this example where no semicolon is used:
%macro field_list();
name,
age,
sex,
height
%mend;
proc sql;
select %field_list()
from sashelp.class
;
quit;
Try running it on your own machine with option mprint;
enabled. The result of running the macro simply returns the block of code within it. This results in the following code being executed:
proc sql;
select name, age, sex, height
from sashelp.class
;
quit;
If we had a semicolon after the call to our macro, then the code that SAS would try to run would include the semicolon which would be invalid syntax like so (note the semicolon after height):
proc sql;
select name, age, sex, height ;
from sashelp.class
;
quit;
This is because the semicolon is NOT required for calling macros, so it just gets left behind and included in the execution of the step.
When you call a macro like you do in the example you give above, it's fine to include the semicolon, because your macro is a fully self contained step. And in open code there's no harm having extraneous semicolons like so:
%macro example2(inDS=, outDs=);
data &outDs;
set &inDs;
run;
%mend;
%example2(inDS=sashelp.class, outDs=tmp_class);
This basically evaluates to:
data tmp_class;
set sashelp.class;
run;;
Note the extra semicolon at the end left over from our call? We could have as many as we wanted and the code will still run fine, ie:
%example2(inDS=sashelp.class, outDs=tmp_class);;;;;;
Resolves to:
data tmp_class;
set sashelp.class;
run;;;;;;;
Which will still run fine as it is valid syntax.