This is my log an it has a warning. Who can tell me what's wrong with my program? Thank you ver much.
The WARNING is DISCRETELEGEND statement not under LAYOUT GLOBALLEGEND is ignored when there is a LAYOUT GL.
MLOGIC(FIGURE): %DO loop index variable ORD1 is now 3; loop will not iterate again.
SYMBOLGEN: Macro variable I resolves to 1
SYMBOLGEN: Macro variable ORD2MAX resolves to 1
SYMBOLGEN: Macro variable LORD1MAX resolves to 2
MLOGIC(FIGURE): %IF condition &i=&ord2max and &lord1max=2 is TRUE
MPRINT(FIGURE): proc template;
MPRINT(FIGURE): define statgraph linechart;
MPRINT(FIGURE): begingraph/border=false;
MPRINT(FIGURE): discreteattrmap name="level" / ignorecase=true ;
MPRINT(FIGURE): value "Day-1" / lineattrs=(color=blue pattern=solid);
MPRINT(FIGURE): value "Day 3" / lineattrs=(color=orange pattern=solid);
MPRINT(FIGURE): value "Day 8" / lineattrs=(color=gray pattern=solid);
MPRINT(FIGURE): value "Day 15" / lineattrs=(color=yellow pattern=solid);
MPRINT(FIGURE): enddiscreteattrmap ;
MPRINT(FIGURE): discreteattrvar attrvar=avisit2 var=avisit1 attrmap="level" ;
MPRINT(FIGURE): legendItem type=line name="Day -1" / lineattrs=(color=blue pattern=solid) label="Day -1";
MPRINT(FIGURE): legendItem type=line name="Day 3" / lineattrs=(color=orange pattern=solid) label="Day 3";
MPRINT(FIGURE): legendItem type=line name="Day 8" / lineattrs=(color=gray pattern=solid) label="Day 8";
MPRINT(FIGURE): legendItem type=line name="Day 15" / lineattrs=(color=yellow pattern=solid) label="Day 15";
MPRINT(FIGURE): layout globallegend / border=false;
MPRINT(FIGURE): discretelegend "Day -1" "Day 3" "Day 8" "Day 15" /autoitemsize=true DISPLAYCLIPPED=true across=2;
MPRINT(FIGURE): endlayout;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable O resolves to 1
SYMBOLGEN: Macro variable TITLETRT1 resolves to "0.1 mg/kg"
MPRINT(FIGURE): entrytitle "0.1 mg/kg";
MPRINT(FIGURE): layout lattice / columns = 1 rows = 2 rowdatarange=union;
MPRINT(FIGURE): drawtext textattrs=(color=black size=10pt weight=bold ) "Glucose Level(mmol/L)"/rotate=90 width=50
xspace=LAYOUTPERCENT yspace=LAYOUTPERCENT x=2 y=50 justify=center;
MPRINT(FIGURE): drawtext textattrs=(color=black size=10pt weight=bold ) "Hours Postdose"/ width=20 xspace=LAYOUTPERCENT
yspace=LAYOUTPERCENT x=50 y=8 justify=center;
MPRINT(FIGURE): cell;
MPRINT(FIGURE): layout overlay / xaxisopts=( gridattrs=(pattern=dot color=black) linearopts=(viewmax=12 viewmin=0
tickvaluesequence=(start=0 end=12 increment=2)) display=(ticks)) yaxisopts=(griddisplay=on gridattrs=(pattern=Solid
color=lightgray) ) ;
SYMBOLGEN: Macro variable SUB1 resolves to zzzz
MPRINT(FIGURE): drawtext textattrs=(color=black size=10pt weight=bold) "zzzz"/ anchor=topright width=15
widthunit=percent xspace=wallpercent yspace=wallpercent x=80 y=80 justify=center ;
MPRINT(FIGURE): seriesplot x=x1 y=y1 / name="linechart" group=avisit2 lineattrs=(thickness=2 pattern=Solid);
MPRINT(FIGURE): endlayout;
MPRINT(FIGURE): endcell;
MPRINT(FIGURE): cell;
MPRINT(FIGURE): layout overlay / xaxisopts=( gridattrs=(pattern=dot color=black) linearopts=(viewmax=12 viewmin=0
tickvaluesequence=(start=0 end=12 increment=2))) yaxisopts=(griddisplay=on gridattrs=(pattern=Solid color=lightgray));
SYMBOLGEN: Macro variable SUB2 resolves to xxxx
MPRINT(FIGURE): drawtext textattrs=(color=black size=10pt weight=bold) "xxxx"/ anchor=topright width=15
widthunit=percent xspace=wallpercent yspace=wallpercent x=80 y=80 justify=center ;
MPRINT(FIGURE): seriesplot x=x2 y=y2 / name="linechart" group=avisit2 lineattrs=(thickness=2 pattern=Solid);
MPRINT(FIGURE): discretelegend "linechart";
MPRINT(FIGURE): endlayout;
MPRINT(FIGURE): endcell;
MPRINT(FIGURE): endlayout;
MPRINT(FIGURE): endgraph;
MPRINT(FIGURE): end;
NOTE: Overwriting existing template/link: Linechart
NOTE: STATGRAPH 'Linechart' has been saved to: WORK.TEMPLAT
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
MPRINT(FIGURE): run;
MPRINT(FIGURE): proc sgrender data=b template=linechart;
MPRINT(FIGURE): run;
WARNING: DISCRETELEGEND statement not under LAYOUT GLOBALLEGEND is ignored when there is a LAYOUT GLOBALLEGEND.
NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of this session.
NOTE: There were 90 observations read from the data set WORK.B.
NOTE: PROCEDURE SGRENDER used (Total process time):
real time 1.45 seconds
cpu time 0.51 seconds
MLOGIC(FIGURE): %DO loop index variable I is now 2; loop will not iterate again.
MLOGIC(FIGURE): %DO loop index variable O is now 2; loop will not iterate again.
MLOGIC(FIGURE): Ending execution.
1941
1942 ods rtf close;
I'm not sure as I have nothing to test with but I think you are running into a violation of this restriction in the Globallegend
The individual legends in the global legend can be arranged in a single row or a single column only.
Your code is using:
discretelegend "Day -1" "Day 3" "Day 8" "Day 15" /autoitemsize=true DISPLAYCLIPPED=true across=2;
and I think that the across=2 is going to try to make a two column two row display for that Discretelegend. Which would place one of the "rows" or "columns" outside of the global legend.
Again, I think.
I would suggest testing with Across=4 as something I think should be easy to test. If that does then if you are wanting a two rwo two column appearance use two Discrete legend statements, each with the Across=2
discretelegend "Day -1" "Day 3" /autoitemsize=true DISPLAYCLIPPED=true across=2; discretelegend "Day 8" "Day 15" /autoitemsize=true DISPLAYCLIPPED=true across=2;
I think that makes two items that are single rows. Again not at all tested as I have nothing to test any similar code with.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.