Hi Cynthia,
Many thanks for your answer. I have used it and it worked BUT the problem is that my banner is dynamic.
Sometimes the banner has 5 items (FR-U FR-G IT-U IT-G JA-U) and other times 3 items (FR-U FR-G IT-G) depending ont he variables to be tabulated.
With the solution you provided and the hardcoding of some values, it obviously wasn't working because the banner items are written sequentially and do not reflect the "true" banner (when items are missing) etc
Below is part of the macros I am using so you can better understand the problem I am facing :
%macro tabsB2 (break1=,break2=,n=)/STORE ;
proc tabulate data=TEMPSAS (keep=&break1 &break2 &&AVAR&n.);
class &&ABREAK1&n. &&ABREAK2&n.;
var &&AVAR&n.;
table N*(&&AVAR&n.) mean*((&&AVAR&n.)*f=4.1), all='Total' &&ABREAK1&n.=&&ABREAK1&n. &&ABREAK2&n.=&&ABREAK2&n. &&ABREAK1&n.=&&ABREAK1&n.*&&ABREAK2&n.=&&ABREAK2&n. / misstext=" " ;
run;
%proba_list
%end;
%mend tabsB2;
where the ABREAK1, ABREAK2, AVAR are arrays of macro variables.
ABREAK1 : contains the countries (FR, GE, IT, SP, UK, US)
ABREAK2 : contains the student type (U, G, PG)
AVAR : contains the variables to be tabulated
Some variables only have values for some of the combinations ABREAK1*ABREAK2 and that is why there is a problem when hardcoding the combination of the breaks values that is used with the GLM proc.
the macro %proba_list is the part that you sent me :
%macro proba_list /STORE;
%cptlist(&&AVAR&n.)
%do i=1 %to &nbvar;
ods exclude all;
ods output diff=work.pdiff (keep= rowname P1 P2 P3 P4 P5 P6 P7 P8 P9);
TITLE %sysfunc(cat(Statistical significance for , %scan(&&AVAR&n,&i)));
proc GLM data = TEMPSAS (keep=&break1 &break2 %scan(&&AVAR&n.,&i));
class &&ABREAK1&n. &&ABREAK2&n.;
model %scan(&&avar&n.,&i) = &&ABREAK1&n.*&&ABREAK2&n. / NOUNI;
lsmeans &&ABREAK1&n.*&&ABREAK2&n. / TDIFF ;
run;
proc sql noprint;
select catt(name,'=','"',put(name,$mh.),'"') as chglabl
into :cl1-:cl10
from dictionary.columns
where libname = 'work' and
memname = 'PDIFF' and
name contains 'P';
quit;
proc datasets library=work nolist;
modify pdiff;
format rowname $rn.;
label &cl1; label &cl2;
label &cl3; label &cl4;
label &cl5; label &cl6;
label &cl7; label &cl8;
label &cl9; label &cl10;
quit;
proc contents data=pdiff;
run;
ods exclude none;
data _null_;
set pdiff;
file print
ods=(template='mymatrix');
put _ods_;
run;
%end;
%mend proba_list;
How can I make the banner dynamic?
Thanks in advance ffor your help
Erwan