One strongly suspects that most of those variables are not needed and that the approach used to do whatever is next is overly complicated as well.
One typical way with SAS to create separate output for levels of a variable is BY group processing, possibly coupled with Where clauses to restrict which data is used. Or other procedures.
Consider this code with a data set you should have available:
proc tabulate data=sashelp.class;
class sex age;
var height weight;
tables sex * (age all='Sex overall') all='All students',
(height weight)*(n mean max min std)
;
run;
This summarizes characteristics of height and weight for Sex and Age combinations, All within a single sex and All students in the data set.
... View more