Hi:
One of the best practices for coming up with robust and correct macro code is to start with a working SAS program before you add any macro variables with the code. Then, after that first step, your next step is to "macroize" the code by using %LET and hard-coded macro variables. Next, after that code proves to work and you debug any issues with quotes or references, if you need a macro program, you then add the %macro/%mend and create parameters and make certain portions of the code conditional with %IF statements or make certain portions of the code get created in a loop with a %DO loop.
So, my questions to you are...where did you start? What is an example of your WORKING SAS code -- that correctly creates the table you want. Also, what is the explanation of your macro variables that you think you need?? It almost seems as though you plan to create a macro variable to hold each different comma that you need??? That really isn't necessary, macro logic or a macro %DO loop would allow you to determine when the end of the list of variables was reached so you could conditionally place the last comma.
One quick workaround, if you are always going to select the PROVFS variable would be to rework your select statement to put that variable last. All the SAS reporting procedures allow you to control the order of the variables you see, so order is not a major issue.:
[pre]
proc sql;
create table &title.1 as
select &base1.y1_f, &base1.y2_f, &base1.y3_f, &base1.y4_f,
&base2.y1_f, &base2.y2_f, &base2.y3_f, &base2.y4_f,
(&base1.y1_f+&base2.y1_f) as &title._sum1,
(&base1.y2_f+&base2.y2_f) as &title._sum2,
(&base1.y3_f+&base2.y3_f) as &title._sum3,
(&base1.y4_f+&base2.y4_f) as &title._sum4,
provfs
from _2010.facrep;
[/pre]
cynthia