BookmarkSubscribeRSS Feed
joshua_owen
Calcite | Level 5

 

So I want a full legend of all 8 treatments to appear on every page I have 48 subjects and they have all taken 1 of 8 treatments (6 subjects to every treatment) so the first 4 subjects appear on page 1 have all taken treatment 1 and so only treatment 1 appears in the legend here is code:

    /* report section*/
    ods rtf file="&place.\&outnum. &outnam1..rtf" style=tfl bodytitle nogtitle nogfootnote ; 
       ods listing close; 
       ods graphics on / height=7.8cm width=25cm border=off ;
       ods listing; 
    %macro paging(p=);
    proc sgpanel data=outputa.f_conc_&type (where=(page=&p)); 
       footnote1 j=l f=courier h=9pt "Source Listing: &slist; Produced: &mdate. &mtime. - Page &p of 10";
       footnote2 j=l f=courier h=9pt "Lower Limit of Quantitation - 1.00 ng/mL.";
       title1 f=courier h=9pt justify=c "&study";
       title2 f=courier h=9pt justify=c "&outnum";
       title3 f=courier h=9pt justify=c "&outnam1";
       title4 f=courier h=9pt justify=c "&outnam2";

          panelby subject / rows=2 columns=2 novarname;
         series x=atptn y=_1    / legendlabel="Trt 1"   name='_1'  lineattrs=(color=blue thickness=1 pattern=1);
         series x=atptn y=_2    / legendlabel="Trt 2"  name='_2'  lineattrs=(color=red thickness=1 pattern=1);
         series x=atptn y=_3     / legendlabel="Trt 3"  name='_3'  lineattrs=(color=green thickness=1 pattern=1);
         series x=atptn y=_4     / legendlabel="Trt 4"  name='_4'  lineattrs=(color=black thickness=1 pattern=1);
         series x=atptn y=_5    / legendlabel="Trt 5"  name='_5'  lineattrs=(color=orange thickness=1 pattern=1);
         series x=atptn y=_6    / legendlabel="Trt 6" name='_6'  lineattrs=(color=purple thickness=1 pattern=1);
         series x=atptn y=_7     / legendlabel="Trt 7" name='_7'  lineattrs=(color=magenta thickness=1 pattern=1);
         series x=atptn y=_8     / legendlabel="Trt 8" name='_8'  lineattrs=(color=brown thickness=1 pattern=1);
         keylegend '_1' '_2' '_3' '_4' '_5' '_6' '_7' '_8' / across=4 down=2;
       colaxis label="Time Post Dose (h)" labelattrs=(family='Courier') values=(0,1,2,3,4,6,8,10,12,16,24,36,48) min=0 max=48;
       rowaxis label="KVD900 Concentration (ng/mL)" &yaxis;
    run;

    %mend paging;
    %paging(p=1);
    %paging(p=2);
    %paging(p=3);
    %paging(p=4);
    %paging(p=5);
    %paging(p=6);
    %paging(p=7);
    %paging(p=8);
    %paging(p=9);
    %paging(p=10);
    ods rtf close; 

Thanks in advance for any help I know this is possible through GTL but if there is an easier way through SGPANEL I would love to know I am using SAS 9.3. Using gtitle and gfootnote is not possible as the headers need to be outside the graph, If there are any questions ask away 🙂

1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 751 views
  • 0 likes
  • 2 in conversation