Hello!

I would be very grateful for any advice.

I am trying to combine a series of plots, which are stratified by categorical variable. To make it clearer:

My variable DDAD has 3 categories (No, Re, Pers), CDAD has the same 3 categories (No, Re, Pers), PRAD has the same + 1 additional one (No, Re, Pers, La).

In total I have 10 plots. I would like to have 3 columns to represent each variable (PRAD, DDAD, PRAD). I would like the common categories for each to be on the same row + the additional fourth category, La, in the PRAD column. I cannot get this configuration. Using the following code, I get 4 rows in the first (correct), four rows for the second column (incorrect) and two rows for the third column). For the latter two, I would like 3 rows each.




I have used -grc1leg- to combine the plots. The plots were constructed using -sq-



Code:
*COLUMN1: PRAD*

*No
sqindexplot if LCA_PRAD==0 , by( PRAD_pmaxcat, rows(1) style(compact) legend(off) note("") title("PRAD")) color(yellow red) gapinclude ylabel(,notick nolabel)  xtitle("Age") ytitle("No AD") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11")  name(g1)

*Re
sqindexplot if LCA_PRAD==2 , by( PRAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ytitle("EO remitting") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g2)

*Pers
sqindexplot if LCA_PRAD==1 , by( PRAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ytitle("Persisting") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g3)

*LO
sqindexplot if LCA_PRAD==3 , by( PRAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ytitle("Late onset") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g4)



*COLUM 2: CDAD*
*No
sqindexplot if LCA_CDAD==0 , by( CDAD_pmaxcat, rows(1) style(compact) legend(off) note("") title("CDAD")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g5)

*Re
sqindexplot if LCA_CDAD==2 , by( CDAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g6)

*Pers
sqindexplot if LCA_CDAD==1 , by( CDAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g7)



*COLUMN 3: DDAD*
*No
sqindexplot if LCA_DDAD==0 , by( DDAD_pmaxcat, rows(1) style(compact) legend(off)  note("") title("DDAD")) color(yellow red) gapinclude ylabel(,notick nolabel)  xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g8)

*Re
sqindexplot if LCA_DDAD==2 , by( DDAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g9)

*Pers
sqindexplot if LCA_DDAD==1 , by( DDAD_pmaxcat, rows(1) style(compact) legend(off) note("")) color(yellow red) gapinclude ylabel(,notick nolabel) xtitle("Age") ///
xlabel(1"1" 2"3" 3"5" 4"8" 5"11") name(g10)




grc1leg g1 g2 g3 g4 g5 g6 g7 g8 g9 g10, colfirst cols(3) rows(4)