BookmarkSubscribeRSS Feed
lucysas
Fluorite | Level 6

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

2 REPLIES 2
PGStats
Opal | Level 21

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

PG

PG
lucysas
Fluorite | Level 6

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

L

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 749 views
  • 3 likes
  • 2 in conversation