- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I need help to add reference line for proc sgplot, i find median survival time to get reference in graph and i can add reference line on both axis too but how to restrict line to specific time point. for example, i want to add line only up to 0.5 on X axis then how i can restrict it?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
it worked. thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure I understand your question.
Are you looking to add a reference line in a plot option of one of the survival procedures like LIFETEST?
Or are you looking to add a line to your SGPLOT code?
If you have have SGPLOT code, please show it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
i am looking to add line in sgplot
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please post code as text copied from the editor and then pasted into a text box opened with the </> icon above the message window. That way if minor corrections to code are needed we can do so. When you post pictures we would have to retype the entire thing and I for one am too lazy to retype much.
If you want to provide a line that connects the points (x,0) to (x, 0.5) , that is not a refline which uses all Y values for a given x or all X values for a given y.
If I understand what you want the easiest may be to add an observation value to your existing data set with the x, y values for the start and end and maybe use a DROPLINE. You can provide and X,Y coordinate and "drop" a line to either the x axis, the y axis or to both.
Here is an example that you should be able run as you should have the SASHELP.CLASS data set:
proc sgplot data=sashelp.class; scatter x=height y=weight; dropline x=60 y=100 / dropto=both; run;
This uses the BOTH option for drop to. Try it with Dropto=X and Dropto=Y for the others.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I need this type of graph with dotted line
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@NP2212 wrote:
I need this type of graph with dotted line
Which looks a lot like Dropline x=9 y=0.5/ drop2=both lineattrs=(pattern=shortdash) ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
it worked. thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @NP2212,
Glad to see that @ballardw's solution worked for you. Then it would be fair and help later readers if you marked his helpful reply as the accepted solution, not your own "thank you" post. Could you please change that? It's very easy: Select his post as the solution after clicking "Not the Solution" in the option menu (see icon below) of the current solution.