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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- piecewise manipulation of time-series data

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-22-2012 10:16 AM

Hi,

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.

Data:

Time Value

1 300

2 320

3 350

4 280

5 300

....etc

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.

Thanks!

Lucy

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-22-2012 10:22 AM

Look at PROC LOESS. I think it does all that you want to do and a lot more...

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-22-2012 12:51 PM

Thanks, I've looked through the documentation and that was supremely helpful to what I was trying to do.

L