BookmarkSubscribeRSS Feed
mantubiradar19
Quartz | Level 8

I'm working with longitudinal data, wherein the person has multiple measurements at different time points as follows. I would like to how I can estimate the rate of decline in this variable over time? Also, what is the best way to visualize this data?

Date          GFR
1/1/15         53
4/7/15         53
8/18/15       54
12/20/15     50
5/13/16       48
10/25/16     49
3/9/17          47
7/15/17        46
1/4/18          48

I'm interested in looking at the distribution of decline in GFR over time. 

2 REPLIES 2
maguiremq
SAS Super FREQ

You can subtract differences with the LAG function. I then used PROC SGPLOT along with the SERIES statement to graph the difference over time. Since it's longitudinal and involves time, I think this is the best option. Notice how I omitted the missing from the PROC SGPLOT statement, too.

 

data have;
input Date :mmddyy10. GFR;
format date mmddyy10.;
datalines;
1/1/15         53
4/7/15         53
8/18/15       54
12/20/15     50
5/13/16       48
10/25/16     49
3/9/17          47
7/15/17        46
1/4/18          48
;

data have_2;
	set have;
		gfr_lag = lag(gfr);
		if not missing(gfr_lag) then do;
			diff = gfr_lag - gfr;
		end;
run;

proc sgplot
	data = have_2 (where = (gfr_lag ~= .));
	series x = date y = diff;
	format date mmddyy10.;
run; 

maguiremq_0-1631301159481.png

Kind of zoomed through this. Let me know if there are issues.

Sajid01
Meteorite | Level 14

Hello @mantubiradar19 
One way is to plot the the GFR as a function of number of days from the start.

The slope of the line will give the rate of decline.
The following code should work.


data src;
input Date_ :mmddyy8.  GFR;
format date_  mmddyy8.;
days=coalesce(lag(days),0)+date_-lag(date_);
if _n_=1 then days=0;
datalines;
1/1/15         53
4/7/15         53
8/18/15       54
12/20/15     50
5/13/16       48
10/25/16     49
3/9/17          47
7/15/17        46
1/4/18          48
;
run;
proc orthoreg data=src;
   model gfr =days;
   effectplot fit / obs;
run;

The  following will be the output. The slope -0.031327867107 is the rate of decline in units of GFR per day.

Sajid01_0-1631303878859.pngSajid01_1-1631303945486.png

 

 

 

 

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

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1106 views
  • 0 likes
  • 3 in conversation