In order to use the variables listed in B as code you can use PROC SQL to create macro variables. These macro variables become part of the PROC FREQ call.
Here is an example that puts the PROC FREQ output into dataset named using the analysis variable names.
[pre]
%let vars = _char_;
** data A the data to summarize;
data A;
set sashelp.shoes;
run;
** data B a list of variable names;
proc transpose data=A(obs=0) out=B;
var _char_;
run;
proc sql noprint;
select _name_ , cats('Freq.Table',monotonic(),'.OneWayFreqs=',_name_)
into :vars separated by ' ', :odsout separated by ' '
from b;
quit;
run;
%put NOTE: VARS=&vars;
%put NOTE- ODSOUT=&odsout;
ods listing close;
proc freq data=a;
tables &vars;
ods output &odsout;
run;
ods listing;
[/pre]