BookmarkSubscribeRSS Feed
Doc_Duke
Rhodochrosite | Level 12
Hi,

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.]

Thanks,
Doc Muhlbaier
Duke
1 REPLY 1
RichardH_sas
SAS Employee
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!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1185 views
  • 0 likes
  • 2 in conversation