I have to dataset with chart below. The Grey Refence Line is x=5021.
Like run two-step Segment Model, Segmented regression models in SAS - The DO Loop
know how to code/run the segment model without constrain, the one on left (x<=5021) and the other on right(x>5021)?!
How to code/run with constrain?! Or with Proc Reg on two datasets chopped into and to stitch together?! Kind of kidgarden though.
Strictly it is not one regression exactly on left of the reference line, and the other regression exactly on the right of the reference line.
What I need is to enforce the second-step in TWO-STEP Segment Regression at the TAIL, RIGHT of the reference line.
It can be reference_line+1, reference_line+10, ...
It sounds like you are trying to fit a piecewise linear regression model. In a piecewise model, the predicted values before the reference line will be based on one set of parameter estimates (for example, the slope and intercept), and the predicted values after the reference line will have a different set of estimates.
In the blog post you referenced, the location of the reference line had to be estimated from the data. That's why it required PROC NLIN. However, for your data, it sounds like you know the location of the breakpoint (x=5021), so you can use linear models from a procedure such as PROC GLM or PROC GLIMMIX. See "Piecewise regression models and spline effects" for a discussion and two examples.
Rick:
Thanks for the response.
I need two-segmented-regression, with the second one at right of the reference value(greater than).
But it can be > 5300, it can be > 5500 ...
So what I need is segment regression with constrain on the 2nd regression on left of the reference value.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.