BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
data_null__
Jade | Level 19

Is there a way to get the Y axis label in the top figure to move closer to the tick labels.  I get why it is positioned this way because of the tick values in the bottom figure.  I'm using GTL.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

John.King ,

That would be better if you could post some data and your GTL code to test your problem.

Here I make some dummy code to give you some help.

 

 

%sganno
data sganno;
 %SGTEXT(LABEL="Monophasic (11pts)",WIDTH=40,DRAWSPACE="LAYOUTPERCENT",ID="BAR",ROTATE=90,X1=15,Y1=30)
run;


proc template;
define statgraph y2axis;
begingraph;
layout lattice / rows=2 rowgutter=10
rowdatarange=union row2datarange=union;


layout overlay /  yaxisopts=( label=" " )  ;
histogram height / scale=count ;
histogram height / scale=percent;
densityplot height / normal();
annotate / id="BAR";
endlayout;

layout overlay /  yaxisopts=( label=" " )  ;
scatterplot y=smoking_Status x=weight;
endlayout;

endlayout;
endgraph;
end;
proc sgrender data=sashelp.heart template=y2axis sganno=sganno;
run;

Ksharp_0-1738549074745.png

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Look at annotation to place text at arbitrary locations. Start here for some details: https://documentation.sas.com/doc/en/pgmsascdc/v_057/grstatgraph/p0rgjcddtqwpyin1ro3kvrksd6js.htm

 

Without data and complete template code I wouldn't even make an attempt at some other work around as there are just too many moving parts with GTL to have a chance of getting a working alternative.

Ksharp
Super User

John.King ,

That would be better if you could post some data and your GTL code to test your problem.

Here I make some dummy code to give you some help.

 

 

%sganno
data sganno;
 %SGTEXT(LABEL="Monophasic (11pts)",WIDTH=40,DRAWSPACE="LAYOUTPERCENT",ID="BAR",ROTATE=90,X1=15,Y1=30)
run;


proc template;
define statgraph y2axis;
begingraph;
layout lattice / rows=2 rowgutter=10
rowdatarange=union row2datarange=union;


layout overlay /  yaxisopts=( label=" " )  ;
histogram height / scale=count ;
histogram height / scale=percent;
densityplot height / normal();
annotate / id="BAR";
endlayout;

layout overlay /  yaxisopts=( label=" " )  ;
scatterplot y=smoking_Status x=weight;
endlayout;

endlayout;
endgraph;
end;
proc sgrender data=sashelp.heart template=y2axis sganno=sganno;
run;

Ksharp_0-1738549074745.png

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 801 views
  • 0 likes
  • 3 in conversation