02-22-2012 10:16 AM
I am not new to programming but I am new to SAS. I am having some trouble understanding how to perform multistep data processing in SAS. At this point, I'm not even sure if it's possible to do what I want to do in SAS.
I have a data matrix that has about 300 entries, where the time increments by 1 and the value fluctuates somewhat randomly with time, as above.
I want to set an N-value, let's say N=10, and perform piecewise linear regressions for every N time points. I then want to subtract the linear regression values from the Value column (detrending the data - piecewise). There are some examples of piecewise linear regressions online, but they are all exclusive to two pieces. I've tried using an additional column to deliminate the pieces, but SAS doesn't perform matrix operations the way I am used to.
I also want to calculate a root-mean-square value for each N time-piece.
Lastly, I want to repeat this for many values of N.
At this point, I can perform the individual actions (linear regression, root-mean-square), but am having trouble cycling through piecewise. I also am having trouble performing calculations on the Values using the results from my regressions.
I would appreciate some help on how to cycle through piecewise regressions.