The label of axes of the three cells are the same. How to merge the labels of the axes,like this picture!
this is my code
proc template;
define statgraph Series;
begingraph;
layout lattice / rows=1 columns = 3 rowdatarange=UNIONALL columndatarange=unionall ;
/* Column and row axes */
columnaxes;
columnaxis / display=all label="Mean Ctrough (Days 85 and 92), ng/mL"
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
columnaxis / display=all label="Mean Ctrough (Days 85 and 92), ng/mL"
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
columnaxis / display=all label="Mean Ctrough (Days 85 and 92), ng/mL"
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
endcolumnaxes;
rowaxes;
rowaxis / label="% Change from Baseline"
linearopts=(tickvaluesequence=(start=-100 end=200 increment=50) tickvaluepriority= true);
endrowaxes;
**Column 1 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "ApoC-III" /valign=top;
scatterplot x=aval y=pchg1 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg1 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
**Column 2 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "TG"/valign=top;
scatterplot x=aval y=pchg1 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg1 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
**Column 3 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "HDL-C"/valign=top;
scatterplot x=aval y=pchg3 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg3 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
sidebar / align=top ;
discretelegend "group" / halign=center across=1 border=false;
endsidebar;
endlayout;
endgraph;
end;
run;
If you want tested code you need to provide example data in form of data step code and the Proc Sgrender code to create the graph.
sorry!try this!
data test;
input USUBJID$ group$ aval pchg1 pchg2 pchg3@@;
datalines;
1102 G1 22.6 41 184.2 5.5
1103 G1 0 -23.6 -42.1 11.6
1104 G1 62.8 -92.7 -79.2 -3.2
1105 G1 0 -16.2 32.6 14.5
1107 G1 0 -2.6 103.4 28.4
1108 G1 112.1 -88.4 -85.7 49.7
4201 G2 42.4 -73.6 -64.1 20
4204 G2 64.2 -51.9 -34.4 38.9
4206 G2 1 0.5 -10.3 -29.9
5001 G3 85.9 -70.6 -63.7 32.2
5002 G3 272 -89.8 -84.4 70.8
5003 G3 166.4 -80.9 -57.2 -13
;
run;
And the Proc SGRENDER to use the template?
data test;
input USUBJID$ group$ aval pchg1 pchg2 pchg3@@;
datalines;
1102 G1 22.6 41 184.2 5.5
1103 G1 0 -23.6 -42.1 11.6
1104 G1 62.8 -92.7 -79.2 -3.2
1105 G1 0 -16.2 32.6 14.5
1107 G1 0 -2.6 103.4 28.4
1108 G1 112.1 -88.4 -85.7 49.7
4201 G2 42.4 -73.6 -64.1 20
4204 G2 64.2 -51.9 -34.4 38.9
4206 G2 1 0.5 -10.3 -29.9
5001 G3 85.9 -70.6 -63.7 32.2
5002 G3 272 -89.8 -84.4 70.8
5003 G3 166.4 -80.9 -57.2 -13
;
run;
data attrmap;
infile datalines dlm="#";
length Value ID MarkerSymbol MarkerColor$200;
input Value$ ID$ MarkerSymbol$ MarkerColor$@@;
datalines;
Monotherapy (Groups 1 and 2) # myid #CircleFilled #blue
Fibrate Combination (Group 3)# myid #TriangleFilled #red
FCS Monotherapy (Group 4) # myid #SquareFilled #green
;
run;
proc sgrender data=final dattrmap=attrmap template=Series;
dattrvar group="myid";
run;
proc template;
define statgraph Series;
begingraph;
layout lattice / rows=1 columns = 3 rowdatarange=UNIONALL columndatarange=unionall ;
/* Column and row axes */
columnaxes;
columnaxis / display=all label=" "
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
columnaxis / display=all label="Mean Ctrough (Days 85 and 92), ng/mL"
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
columnaxis / display=all label=" "
linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true);
endcolumnaxes;
rowaxes;
rowaxis / label="% Change from Baseline"
linearopts=(tickvaluesequence=(start=-100 end=200 increment=50) tickvaluepriority= true);
endrowaxes;
**Column 1 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "ApoC-III" /valign=top;
scatterplot x=aval y=pchg1 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg1 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
**Column 2 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "TG"/valign=top;
scatterplot x=aval y=pchg2 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg2 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
**Column 3 content;
layout overlay;
entry halign=center textattrs=(size=9pt) "HDL-C"/valign=top;
scatterplot x=aval y=pchg3 /group=group name="group" markerattrs=(size=10);
regressionplot x=aval y=pchg3 /lineattrs=(thickness=4 color=green) degree=3;
endlayout;
sidebar / align=top ;
discretelegend "group" / halign=center across=1 border=false;
endsidebar;
endlayout;
endgraph;
end;
run;
proc sgrender data=test dattrmap=attrmap template=Series;
dattrvar group="myid";
run;
I notice this template is not the same as the first shown and is basically where I would start: just provide actual label text under one column. It displays the label in only the center graph but may get truncated depending on the width of the graph created. You might try the Labelpostion=center and see if you like the look though if the width of the center graph doesn't allow enough space it will still be truncated.
OR
columnaxes; columnaxis / display=all label=" " linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true); columnaxis / display=all label="Mean Ctrough*(Days 85 and 92)*ng/mL" linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true) labelfitpolicy=splitalways labelsplitchar='*' ; columnaxis / display=all label=" " linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true); endcolumnaxes;
Which will split the label resulting in something similar to this on the Axis splitting the label at the positions of the inserted *:
Mean Ctrough (Days 85 and 92) ng/mL
Last option might be to suppress the label and use an Annotate data set to write text but that is a last choice as you may have to spend a lot of time with other options to create the space for that label to appear correctly.
@zzh4434 wrote:
data test; input USUBJID$ group$ aval pchg1 pchg2 pchg3@@; datalines; 1102 G1 22.6 41 184.2 5.5 1103 G1 0 -23.6 -42.1 11.6 1104 G1 62.8 -92.7 -79.2 -3.2 1105 G1 0 -16.2 32.6 14.5 1107 G1 0 -2.6 103.4 28.4 1108 G1 112.1 -88.4 -85.7 49.7 4201 G2 42.4 -73.6 -64.1 20 4204 G2 64.2 -51.9 -34.4 38.9 4206 G2 1 0.5 -10.3 -29.9 5001 G3 85.9 -70.6 -63.7 32.2 5002 G3 272 -89.8 -84.4 70.8 5003 G3 166.4 -80.9 -57.2 -13 ; run; data attrmap; infile datalines dlm="#"; length Value ID MarkerSymbol MarkerColor$200; input Value$ ID$ MarkerSymbol$ MarkerColor$@@; datalines; Monotherapy (Groups 1 and 2) # myid #CircleFilled #blue Fibrate Combination (Group 3)# myid #TriangleFilled #red FCS Monotherapy (Group 4) # myid #SquareFilled #green ; run; proc sgrender data=final dattrmap=attrmap template=Series; dattrvar group="myid"; run; proc template; define statgraph Series; begingraph; layout lattice / rows=1 columns = 3 rowdatarange=UNIONALL columndatarange=unionall ; /* Column and row axes */ columnaxes; columnaxis / display=all label=" " linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true); columnaxis / display=all label="Mean Ctrough (Days 85 and 92), ng/mL" linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true); columnaxis / display=all label=" " linearopts=(TICKVALUELIST=(0 100 200 300 400 500 600 ) tickvaluepriority= true); endcolumnaxes; rowaxes; rowaxis / label="% Change from Baseline" linearopts=(tickvaluesequence=(start=-100 end=200 increment=50) tickvaluepriority= true); endrowaxes; **Column 1 content; layout overlay; entry halign=center textattrs=(size=9pt) "ApoC-III" /valign=top; scatterplot x=aval y=pchg1 /group=group name="group" markerattrs=(size=10); regressionplot x=aval y=pchg1 /lineattrs=(thickness=4 color=green) degree=3; endlayout; **Column 2 content; layout overlay; entry halign=center textattrs=(size=9pt) "TG"/valign=top; scatterplot x=aval y=pchg2 /group=group name="group" markerattrs=(size=10); regressionplot x=aval y=pchg2 /lineattrs=(thickness=4 color=green) degree=3; endlayout; **Column 3 content; layout overlay; entry halign=center textattrs=(size=9pt) "HDL-C"/valign=top; scatterplot x=aval y=pchg3 /group=group name="group" markerattrs=(size=10); regressionplot x=aval y=pchg3 /lineattrs=(thickness=4 color=green) degree=3; endlayout; sidebar / align=top ; discretelegend "group" / halign=center across=1 border=false; endsidebar; endlayout; endgraph; end; run; proc sgrender data=test dattrmap=attrmap template=Series; dattrvar group="myid"; run;
thanks,I wrote three identical columnaxes, and then assigned the labels of 1 and 3 to null. What I want is whether I can just write only one columnaxis,
Then the three cells all display the same x axis, and the label is displayed in the middle cell.
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 25. 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.