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.
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;
Kind of zoomed through this. Let me know if there are issues.
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.