%let BEF = B.PNR, B.FAMILIE_ID, B.OPR_LAND /* missing semicolon */
%macro sql_bef(start,end);
%do year = &start. %to &end. /* missing semicolon */
proc sql;
create tables test as
select A.ID , &BEF.
on A.ID = B.ID /* missing from and join clause */
order by ID;
quit;
%end;
%mend;
%sql_bef(2012,2018)
Given the multiple serious syntax mistakes in this code piece, I STRONGLY suggest you start with non-macro code first and get it to run without ANY ERRORs, WARNINGs or extraneous NOTEs. Only when that goal has been reached, you can start to make the code dynamic.
... View more