I have data on a dependent variable y and an explanatory one, x, and want to find out if there is a non-linear relationship between theses by running regressions where the data is divided in quartiles from the lowest to the highest value of x. So for example, what is the slope of x when x lies in the first quartile, say between 0 and 4 compared to when in the second, say between 4 and 10? I´m confused on how to accomplish this in Stata. Any help would be much appreciated!

Thanks in advance

Oscar