I have a graph in which layout overlay is nested in Layout Lattice! I need split the label of y axis , how can achieve this
When I use labelfitpolicy=Split its being replaced with AUTO
From documentation I see the following
Default | AUTO |
Interactions | This option has effect only when LABELPOSITION= is CENTER or DATACENTER. |
When the overlay layout is nested in a lattice layout, SPLIT is ignored and AUTO is used instead. |
How Can I achieve this now?
Please let me know your thoughts!!
Thanks
J
Well, the doc clearly says you cannot use split Y axis when Overlay is nested in a Lattice. If you attach your program and data and a figure of what you want, maybe we can find an alternative. Which release of SAS are you using?
Hi
I am using SAS 9.4 version , Please see yaxis label!!
proc template;
define statgraph plot1;
begingraph / designwidth=9.0in designheight=5.05in border=yes;
entrytitle "¶m" / textattrs=(size=9);
layout lattice / columndatarange=union rowweights=(0.95); ;
layout overlay /
xaxisopts=(name="xaxis" discreteopts=(tickvaluefitpolicy=extract) offsetmax=0.05 tickvalueattrs=(size=9pt) type=linear display=(line ticks tickvalues)
linearopts=(tickvaluefitpolicy=none tickvaluelist=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33)
))
yaxisopts=(label="This is a ver very very very very long long long text" tickvalueattrs=(size=9pt)
linearopts=(tickvaluesequence=(start=&&ymin&i end=&&ymax&i increment=&&ytick&i) viewmin=&&ymin&i viewmax=&&ymax&i minorticks=true)
);
seriesplot x=eval(atptn-1*&offx) y=mean1/ lineattrs=graphdata1(pattern=solid thickness=1) name='1' legendlabel="Drug C";
scatterplot x=eval(atptn-1*&offx) y=mean1/ YErrorUpper=High1 YErrorLower=Low1
markerattrs=graphdata1(symbol=trianglefilled size=10) errorbarattrs=graphdata1(pattern=solid)
name='a' legendlabel="Drug C";
seriesplot x=eval(atptn) y=mean2 / lineattrs=graphdata2(pattern=shortdash thickness=1) name='2' legendlabel="Drug A";
scatterplot x=eval(atptn) y=mean2 / YErrorUpper=High2 YErrorLower=Low2
markerattrs=graphdata2(symbol=circlefilled size=8.5) errorbarattrs=graphdata2(pattern=solid)
name='b' legendlabel="Drug A";
seriesplot x=eval(atptn+1*&offx) y=mean3 / lineattrs=graphdata3(pattern=mediumdash thickness=1) name='3' legendlabel="Drug B";
scatterplot x=eval(atptn+1*&offx) y=mean3 / YErrorUpper=High3 YErrorLower=Low3
markerattrs=graphdata3(symbol=asterisk size=8.5) errorbarattrs=graphdata3(pattern=solid)
name='c' legendlabel="Drug B";
endlayout;
sidebar / spacefill=false;
discretelegend 'a' 'b' 'c' / title='Treatment Group: ' across=3;
endsidebar;
endlayout;
endgraph;
end;
run;
PARAMCD | PARAM | trta1 | SEQ | VISIT | n1 | mean1 | stderr1 | high1 | low1 | trta2 | n2 | mean2 | stderr2 | high2 | low2 |
TESTCD | Test | DRUG A | 1 | Day 1 | 15 | 118.4444 | 3.90552 | 122.35 | 114.5389 | DRUG B | 15 | 109.5 | 2.958968 | 112.459 | 106.541 |
TESTCD | Test | DRUG A | 2 | Day 2 | 15 | 114.2222 | 4.112237 | 118.3345 | 110.11 | DRUG B | 15 | 107.75 | 2.296654 | 110.0467 | 105.4533 |
TESTCD | Test | DRUG A | 3 | Day 3 | 15 | 117 | 4.368447 | 121.3684 | 112.6316 | DRUG B | 15 | 111.5 | 2.692582 | 114.1926 | 108.8074 |
TESTCD | Test | DRUG A | 4 | Day 4 | 15 | 120.1111 | 5.078398 | 125.1895 | 115.0327 | DRUG B | 15 | 115.1667 | 3.161878 | 118.3285 | 112.0048 |
TESTCD | Test | DRUG A | 5 | Day 5 | 15 | 115.3333 | 2.44949 | 117.7828 | 112.8838 | DRUG B | 15 | 111.4167 | 3.583333 | 115 | 107.8333 |
TESTCD | Test | DRUG A | 6 | Day 6 | 15 | 115.7778 | 4.875613 | 120.6534 | 110.9022 | DRUG B | 15 | 110.25 | 2.46836 | 112.7184 | 107.7816 |
TESTCD | Test | DRUG A | 7 | Day 7 | 15 | 112.1111 | 4.21454 | 116.3257 | 107.8966 | DRUG B | 15 | 107.3333 | 2.422537 | 109.7559 | 104.9108 |
TESTCD | Test | DRUG A | 8 | Day 8 | 15 | 115 | 4.546061 | 119.5461 | 110.4539 | DRUG B | 15 | 108.5 | 2.053542 | 110.5535 | 106.4465 |
TESTCD | Test | DRUG A | 9 | Day 9 | 15 | 112.5556 | 4.343293 | 116.8988 | 108.2123 | DRUG B | 15 | 107.7143 | 3.263903 | 110.9782 | 104.4504 |
TESTCD | Test | DRUG A | 10 | Day 10 | 15 | 120 | 4.734624 | 124.7346 | 115.2654 | DRUG B | 15 | 117.9286 | 4.253588 | 122.1822 | 113.675 |
TESTCD | Test | DRUG A | 11 | Day 11 | 15 | 115 | 4.898979 | 119.899 | 110.101 | DRUG B | 15 | 112.5 | 3.562241 | 116.0622 | 108.9378 |
TESTCD | Test | DRUG A | 12 | Day 12 | 15 | 115.5556 | 4.687783 | 120.2433 | 110.8678 | DRUG B | 15 | 113.5 | 3.735411 | 117.2354 | 109.7646 |
TESTCD | Test | DRUG A | 13 | Day 13 | 15 | 109.2222 | 3.035795 | 112.258 | 106.1864 | DRUG B | 15 | 109.2143 | 2.568145 | 111.7824 | 106.6461 |
TESTCD | Test | DRUG A | 14 | Day 14 | 15 | 110.6667 | 4.705198 | 115.3719 | 105.9615 | DRUG B | 15 | 110.6429 | 2.873921 | 113.5168 | 107.7689 |
TESTCD | Test | DRUG A | 15 | Day 15 | 15 | 114 | 4.487637 | 118.4876 | 109.5124 | DRUG B | 15 | 110.8571 | 3.60838 | 114.4655 | 107.2488 |
Your GTL code has macro variables and some variables not included. I changed some of those values and got a graph showing the entire Y axis label. Reducing the height of the graph did produce the log message. You can set LabelSplitPolicy to SPLITALWAYS and set LABELSPLITCHAR="," to split it where you want.
yaxisopts=(label="This is a ver very very very very, long long long text" tickvalueattrs=(size=9pt)
labelfitpolicy=splitalways labelsplitchar=','
Also, I think this graph can be made using SGPLOT as shown below without the macro variables where due to the absence of the LATTICE, the Y axis gets split as expected. For some reason, I cannot attach the image.
proc sgplot data=values;
series x=seq y=mean1/ lineattrs=graphdata1(pattern=solid thickness=1) name='1' legendlabel="Drug C";
scatter x=seq y=mean1/ YErrorUpper=High1 YErrorLower=Low1
markerattrs=graphdata1(symbol=trianglefilled size=10) errorbarattrs=graphdata1(pattern=solid)
name='a' legendlabel="Drug C";
series x=seq y=mean2 / lineattrs=graphdata2(pattern=shortdash thickness=1) name='2' legendlabel="Drug A";
scatter x=seq y=mean2 / YErrorUpper=High2 YErrorLower=Low2
markerattrs=graphdata2(symbol=circlefilled size=8.5) errorbarattrs=graphdata2(pattern=solid)
name='b' legendlabel="Drug A";
xaxis integer values=(1 to 15 by 1);
yaxis label="This is a very very very very very long long long text";
keylegend 'a' 'b';
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.