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

Do you know when seglabelfitpolicy=noclip is useful while using vbarbasic/hbarbasic of proc sgplot?

Would you have an example?

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
webart999ARM
Quartz | Level 8

The seglabelfitpolicy=noclip option in proc sgplot is useful when you want to prevent the labels for the segments in a bar chart from being "clipped" or cut off. This can happen when the labels are too long to fit within the space allocated for the bars in the chart.

To use the seglabelfitpolicy=noclip option, you will need to include it in the vbarbasic or hbarbasic statement in proc sgplot. For example:

 

proc sgplot data=mydata;
vbar y=value / category=category response=response group=group
seglabelfitpolicy=noclip;
run;

In this example, the seglabelfitpolicy=noclip option is applied to the vbar chart. This will prevent the labels for the segments in the chart from being cut off if they are too long to fit within the space allocated for the bars.

Alternatively, you can use the labelmaxlen option in the vbarbasic or hbarbasic statement to specify the maximum length for the labels in the chart. This will prevent the labels from being cut off even if they are longer than the space allocated for the bars. For example:

 

proc sgplot data=mydata;
vbar y=value / category=category response=response group=group
labelmaxlen=30;
run;

In this example, the labelmaxlen option is set to 30, which means that the labels in the chart will be truncated to 30 characters if they are longer than that. This will prevent the labels from being cut off and ensure that they fit within the space allocated for the bars in the chart.

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Don't have an actual code example to hand.

The use would be when your boss wants to see the entire label he has assigned to segments and the text would normally not fit within the basic graphing area but would slightly extend into the axis areas. This might be of need when a standard display area for a report does not have enough room to allow use of more graph area to fit longer labels.

 

Think labels like "Division A" "Division B" "My Very Important Justification for a Bonus" (or a paraphrase)

 

 

 

webart999ARM
Quartz | Level 8

The seglabelfitpolicy=noclip option in proc sgplot is useful when you want to prevent the labels for the segments in a bar chart from being "clipped" or cut off. This can happen when the labels are too long to fit within the space allocated for the bars in the chart.

To use the seglabelfitpolicy=noclip option, you will need to include it in the vbarbasic or hbarbasic statement in proc sgplot. For example:

 

proc sgplot data=mydata;
vbar y=value / category=category response=response group=group
seglabelfitpolicy=noclip;
run;

In this example, the seglabelfitpolicy=noclip option is applied to the vbar chart. This will prevent the labels for the segments in the chart from being cut off if they are too long to fit within the space allocated for the bars.

Alternatively, you can use the labelmaxlen option in the vbarbasic or hbarbasic statement to specify the maximum length for the labels in the chart. This will prevent the labels from being cut off even if they are longer than the space allocated for the bars. For example:

 

proc sgplot data=mydata;
vbar y=value / category=category response=response group=group
labelmaxlen=30;
run;

In this example, the labelmaxlen option is set to 30, which means that the labels in the chart will be truncated to 30 characters if they are longer than that. This will prevent the labels from being cut off and ensure that they fit within the space allocated for the bars in the chart.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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