BookmarkSubscribeRSS Feed
CathyVI
Lapis Lazuli | Level 10

Hi,

I am trying to replicate this graph. This is from a study https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7214907/

This is a  two-piecewise linear regression model. I will like to know the sas code which can be used to replicate this graph.

 

 

Adewumi_0-1620779302227.png

 

4 REPLIES 4
WarrenKuhfeld
Ammonite | Level 13

Look at proc transreg.

Ksharp
Super User
proc sgplot data=sashelp.heart(obs=1000);
loess x=weight y=height/clm nomarkers;
run;

SGPlot4.png

Rick_SAS
SAS Super FREQ

See the article "Piecewise regression models and spline effects" for a discussion, example, and code.  The example uses PROC GLIMMIX, but also includes a reference to the PROC TRANSREG documentation, which contains a second example.

 

The example assumes that the two pieces of the model both have the same form (for example, linear or quadratic). If you want to mix-and-match models on separate domains, you can use PROC NLIN to construct a segmented regression model.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1508 views
  • 2 likes
  • 4 in conversation