Hello Hope there is someone who can help me with this one: I have multiple datasets called BEF201212, BEF201312, BEF201412 and etc. I do also have en external datafile which I have to join on my BEF201212 etc. tables. Therefore I have chosen a do loop in a Proc SQL procedure. I want to make a %let variable where the variables I want to keep from BEF201212 etc. is located. So next time I need the code with different variables I can just change the %let macro statement. My code look like this: %let BEF = B.PNR, B.FAMILIE_ID, B.OPR_LAND %macro sql_bef(start,end); %do year = &start. %to &end. proc sql; create tables test as select A.ID , &BEF. on A.ID = B.ID order by ID; quit; %end; %mend; %sql_bef(2012,2018) When I run the above macrocode my log tells me: "NOTE: Line generated by the macro variable "BEF". B.PNR, B.FAMILIE_ID, B.OPR_LAND GOPTIONS NOACCESIBLE How can I define my select variables in a macro? Kind regards Frank
... View more