BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Claus_Stenberg
Fluorite | Level 6

I am doing an template for an AE dotplot for clinical trials. The text string for a preferred term is shown on the y axis. Often the text string is very long why I want have a line break so the term will be on two lines (the y axis tick mark label). I have tried to get force a line shift in the text string by setting in the unicode for a line break  - (*ESC*){unicode '000a'x} - but that does not work. 

I am doing the plot in GTL

 

proc template;
   define statgraph aedotplot;
   
      begingraph ;

    
         layout lattice /columns=5 
                         columnweights = (0.4 0.1 0.1 0.2 0.2) 
                         rowdatarange=unionall 
                         columngutter=0 
                         ;
                         

            layout overlay / walldisplay=none 
                             border=false 
                             x2axisopts=(display=(tickvalues ) 
                             displaysecondary=(line)) 
                             yaxisopts=(linearopts=(tickvaluesequence=(start=1 end=&count increment=1))
                                       display=none
                                       displaysecondary=none
                                       );

      /*--Draw alternating bands using referenceline--*/
               referenceline y = display2nd/ lineattrs=(thickness=&RefThickness.PCT) datatransparency=0.9;
/*             left colum with text box */
               scatterplot y=display x=display_label / markercharacter=display MARKERCHARACTERPOSITION=right yaxis=Y xaxis=X2 markerattrs=(size=0) includemissinggroup=true;

            endlayout;
......

 

 

Any ideas ? 

 

 

 

 

 aedotplot.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Claus_Stenberg
Fluorite | Level 6

Thanks for the suggestion Rick. 

However, can't get it to work....... Is it like this you would suggest (don't mind the plot - give no meaning what so ever ! - should give a tick label with two line with the name of students).:

 

proc template;
   define statgraph plot;
   begingraph ;
      layout overlay /   YAXISOPTS = (LABELFITPOLICY=SPLIT 
                                       labelsplitchar="|" ) 
                                      ; 
             scatterplot y=name2 x=age;
      endlayout;
   Endgraph;
   end;
 run;

 data class2;
    set sashelp.class;
    name2=name||"|"||name;
run;    
    
 proc sgrender data=class2 template=plot;
 run;

 

  

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Try adding LABELFITPOLICY=SPLIT iIn the YAXISOPTS=(...) list of options.

And instead of unicode, define 

labelsplitchar=";" 

(or some other character) and imbed the split character into the labels.

Claus_Stenberg
Fluorite | Level 6

Thanks for the suggestion Rick. 

However, can't get it to work....... Is it like this you would suggest (don't mind the plot - give no meaning what so ever ! - should give a tick label with two line with the name of students).:

 

proc template;
   define statgraph plot;
   begingraph ;
      layout overlay /   YAXISOPTS = (LABELFITPOLICY=SPLIT 
                                       labelsplitchar="|" ) 
                                      ; 
             scatterplot y=name2 x=age;
      endlayout;
   Endgraph;
   end;
 run;

 data class2;
    set sashelp.class;
    name2=name||"|"||name;
run;    
    
 proc sgrender data=class2 template=plot;
 run;

 

  

ballardw
Super User

Try

template;
   define statgraph plot;
   begingraph ;
      layout overlay /   YAXISOPTS = (discreteopts =( tickvaluefitpolicy=splitalways
                                       tickvaluesplitchar="|"
                                       
                                       ) 
                                     ) 
                                      ; 
             scatterplot y=name2 x=age;
      endlayout;
   Endgraph;
   end;
 run;

Make sure your graph has enough vertical space for all the split lines.

LABEL policies are for the thing like "Student name" that describes the axis as a whole. TICKVALUE policies affect the tick value text appearance.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 2278 views
  • 3 likes
  • 3 in conversation