Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- Programming
- /
- Graph in linear regression model

Options

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-18-2021 02:01 PM
(705 views)

I will like to replicate this graph and knowing the types of code to use. Most importantly, I will like to know which sas code will produce the darker line under the mean telomere length.

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

What does the graph represent?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The graph represent a two-piecewise linear regression model. This is the link to the article

https://pubmed.ncbi.nlm.nih.gov/32411758/

https://pubmed.ncbi.nlm.nih.gov/32411758/

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The "heavy line" at the bottom of the graph is referred to as a FRINGEPLOT and is on of the plot statements in the SAS Graph Template Language. A NEEDLE plot with appropriate data can also make something like that.

Do you have the full document that link references? If you are looking for code to do the same regression then we need to know the exact regression they did and possibly even code used as there are lots of options for regressions and guessing won't help you much.

The full paper might even include how the graph was made.

The first step would be getting the data needed for the plot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

SGPLOT with SERIES statements for the lines and a NEEDLE statement for the spikes at the bottom.

Here's a good intro tutorial.

https://support.sas.com/resources/papers/proceedings10/154-2010.pdf

Not sure if you want the needles on the same axis or a different axis, so I'm including an example with it on a secondary axis. If you don't want it on a secondary axis remove anything related to the Y2AXIS statements.

```
proc sgplot data=sashelp.stocks;
where stock = "IBM";
series x=date y=high;
series x=date y=low;
needle x=date y=volume / y2axis;
y2axis values=(0 to 100000000 by 10000000);
run;
```

@CathyVI wrote:

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Using FRINGE statement.

```
proc sgplot data=sashelp.cars;
loess x=MPG_Highway y=Wheelbase /clm ;
fringe MPG_Highway;
run;
```

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

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.

Ready to level-up your skills? Choose your own adventure.