Desktop productivity for business analysts and programmers

Repeated Measures -- trapezoid rule

Trusted Advisor
Posts: 2,114

Repeated Measures -- trapezoid rule


I'm stumped. I am looking for a point-and-click (EGuide) way to compute the area under a curve, where each point on the curve is on a separate record. Each record has ID, Time, Assay and I want to use the trapezoid rule to compute the area under the curve that you draw if you connect the time-assay dots within each ID [ 1/2(Assay(Time k)-Assay(Time k-1))*( (time k) - (time k-1) ) ]. This is relatively straightforward to do in a DATA step with the data sorted on ID and Time (using the LAG and RETAIN functionality of the DATA step). Anyone know how I can do it using the tasks available in EGuide?

[I have a researcher who wanted to summarize her data this way; she only knows the point-n-click interface of EGuide. I'd rather show how to do this building on the tools she already knows than having the pain of learning to code.]

Doc Muhlbaier
SAS Employee
Posts: 149

Re: Repeated Measures -- trapezoid rule

Hi Doc,

I can't think of an easy way to do this in EG. You could do two separate transposes to get your time varaibles in a row and your assay variables in a row then join them... but then you'd have to compute each area difference with a separate variable, yuck.

I was trying some stuff with a self-join of the initial table to itself, but the best I could do was all possible rows in which time_j > time_k. You'd really rather time_j = time_j+1.

So... my best suggestion now would be to write some code for her, add some appropriate parameters, and show her how to run the project to get what she needs. The reason it's so hard to take the point and click approach is that EG Filter and Query is PROC SQL behind the scenes, and PROC SQL is not designed to give you the row-level control you're describing here.

Sorry I don't have a better answer!
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation