Hi,
I created a simple AE example to show my problems. In SGPlot for highlow, y=AEDECOD. When y axis option of display "novalues" is commented, it does show AEDECOD on the left. But some AEDECOD is long, I want to wrap it for example "Influenza" (wrap) "like illness". Is there any way to do it? Below is my code.
Thanks a lot for reading and help!
data AE; length AEDECOD $200; AEDECOD='Influenza like illness';AESTDY=1;AEENDY=10;output; AEDECOD='Haemarthrosis';AESTDY=3;AEENDY=14;output; run;
proc sgplot data=AE; highlow y=AEDECOD low=AESTDY high=AEENDY / type=bar lineattrs=(color=black pattern=solid) barwidth=0.8; xaxis grid display=(nolabel) values=(0 to 15); yaxis grid display=(noticks /*novalues*/ nolabel); run;
1. Choose a "split character". I will use '/'.
2. Insert the split character where you want the string to split.
3. Add FITPOLICY=SPLITALWAYS SplitChar='/' to the YAXIS statement.
data AE;
length AEDECOD $200;
AEDECOD='Influenza/like illness';AESTDY=1;AEENDY=10;output;
AEDECOD='Haemarthrosis';AESTDY=3;AEENDY=14;output;
run;
proc sgplot data=AE;
highlow y=AEDECOD low=AESTDY high=AEENDY
/ type=bar lineattrs=(color=black pattern=solid) barwidth=0.8;
xaxis grid display=(nolabel) values=(0 to 15);
yaxis grid display=(noticks /*novalues*/ nolabel)
fitpolicy=SplitAlways splitchar='/';
run;
Thanks a lot for help! It works great. I tried fitpolicy=split and split='/' but it did not work.
@jsbyxws wrote:
Thanks a lot for help! It works great. I tried fitpolicy=split and split='/' but it did not work.
If the fitpolicy=split is used the split only takes place when the text is "long", meaning that the current space used for the tick value is not long enough to hold the value on a single line. So when "Influenza / like illness" fits on a line it isn't split. But "Influenze like / longer text" might.
This is dependent on size of graph and other options like font size so is a bit problematic for reliable splitting of "short" values.
Oh. That's why! Thanks for the explanation.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.