turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Adding an extra mark on xaxis (sgplot)

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

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

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago - last edited 2 weeks ago

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

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)?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

Exactly =) Just this graph with extra 0.9 between 0.8 and 1.0 (x0 has only one value 0.9)

Solution

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago - last edited 2 weeks ago

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

2 weeks ago

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.