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

Hi,

 

I have a question about proc sgplot. I created a graph which has the probability of an outcome by an x value, and then I added another x series to show the point where the maximum probability is attained. Here is my code:

 

 

proc sgplot data=ex dattrmap=attr1;

series x=x_value y=probability/ group=Group linattrs = (thickness=3px) attrid=Group;

series x=max y=probability/group=Group Datalabel=Max markers markerattrs=(symbol=circlefilled size=10px) attrid=Group;

yaxis integer values=(0 to 0.11 by .01);

xaxis integer values=(1 2 3 4 5 5.10) offsetmax=.01;

run;

 

The problem is that I cosmetically need the x axis to show only the values 1 to 5, but then for it in reality to go slightly over 5 to show the point where the probability reaches the maximum (5.10). The code above gives me the x-axis values 1 3 and 5, for some reason. I would like it to say 1 through 5, but still show the point 5.10 on the graph. Does anyone know how to do this?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Yes, use the VALUESHINT option, It will display only 1-5, but let the data go beyond either end of your values list:

 

xaxis integer values=(1 2 3 4 5) valueshint offsetmax=.01;

 

Hope this helps!

Dan

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Yes, use the VALUESHINT option, It will display only 1-5, but let the data go beyond either end of your values list:

 

xaxis integer values=(1 2 3 4 5) valueshint offsetmax=.01;

 

Hope this helps!

Dan

Caetreviop543
Obsidian | Level 7

Hi Dan,

 

That works! Thanks.

 

Emily 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 3085 views
  • 0 likes
  • 2 in conversation