Solved
New Contributor
Posts: 3

# Adding an extra mark on xaxis (sgplot)

I want to add an extra tick on X axis to existing values (I don't want to change them). How can I do it, could somebody help me?

There is the code:

```proc sgplot data=pdf2 noautolegend;
title "Posterior Probability Density - Beta Distribution";
series x=x y=y; /*the curve*/
scatter x=x0 y=pdf0; /*the dot*/
vector x=x0 y=pdf0 /xorigin=x0 yorigin=0 noarrowheads datalabel lineattrs=(color=gray); /*the line below the dot*/
band x=x1 lower=0 upper=y1;
xaxis grid label="x";
yaxis grid label="Beta Posterior PDF";
refline 0 / axis=y;
run;```

and here should be the value x0 = 0.9 (not hardcoded 0.9, x0 can be changed). I use SAS 9.3, I am hope for your help.

Accepted Solutions
Solution
‎09-15-2017 08:29 AM
PROC Star
Posts: 1,283

## Re: Adding an extra mark on xaxis (sgplot)

[ Edited ]

ok. I cant see your data, so if it is not structured exactly like this, then modify yourself, but do something like this

``````data somedata;
do x = 0 to 1 by 0.01;
y = x*2;
x0=0.9;
output;
end;
if _N_=1 then call symputx('x0', x0);
run;

title "Some Plot";
proc sgplot data=somedata;
series x=x y=y;
xaxis values=(0 to 1 by 0.2 &x0);
run;``````

All Replies
PROC Star
Posts: 1,283

## Re: Adding an extra mark on xaxis (sgplot)

So you want an extra tick value on the x axis corresponding to the value of x0, but not any other ticks (other than the ones that are already there)?

New Contributor
Posts: 3

## Re: Adding an extra mark on xaxis (sgplot)

Exactly =) Just this graph with extra 0.9 between 0.8 and 1.0 (x0 has only one value 0.9)
Solution
‎09-15-2017 08:29 AM
PROC Star
Posts: 1,283

## Re: Adding an extra mark on xaxis (sgplot)

[ Edited ]

ok. I cant see your data, so if it is not structured exactly like this, then modify yourself, but do something like this

``````data somedata;
do x = 0 to 1 by 0.01;
y = x*2;
x0=0.9;
output;
end;
if _N_=1 then call symputx('x0', x0);
run;

title "Some Plot";
proc sgplot data=somedata;
series x=x y=y;
xaxis values=(0 to 1 by 0.2 &x0);
run;``````

New Contributor
Posts: 3

## Re: Adding an extra mark on xaxis (sgplot)

I thought about it but hoped that there is more simple solution (like some statement). Thank you for your reply, looks like I have to use this approach.

☑ This topic is solved.