<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Estimating the rate of decline in a variable over time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/767103#M243156</link>
    <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maguiremq_0-1631301159481.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63498iFD96BE7FD47924D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maguiremq_0-1631301159481.png" alt="maguiremq_0-1631301159481.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Kind of zoomed through this. Let me know if there are issues.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Sep 2021 19:12:55 GMT</pubDate>
    <dc:creator>maguiremq</dc:creator>
    <dc:date>2021-09-10T19:12:55Z</dc:date>
    <item>
      <title>Estimating the rate of decline in a variable over time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/766761#M243143</link>
      <description>&lt;P&gt;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?&lt;/P&gt;
&lt;PRE&gt;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&lt;/PRE&gt;
&lt;P&gt;I'm interested in looking at the distribution of decline in GFR over time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 03:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/766761#M243143</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2021-09-09T03:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating the rate of decline in a variable over time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/767103#M243156</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maguiremq_0-1631301159481.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63498iFD96BE7FD47924D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maguiremq_0-1631301159481.png" alt="maguiremq_0-1631301159481.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Kind of zoomed through this. Let me know if there are issues.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 19:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/767103#M243156</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-09-10T19:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating the rate of decline in a variable over time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/767111#M243158</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16379"&gt;@mantubiradar19&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;One way is to plot the the GFR as a function of number of days from the start.&lt;/P&gt;
&lt;P&gt;The slope of the line will give the rate of decline.&lt;BR /&gt;The following code should work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The&amp;nbsp; following will be the output. The slope&amp;nbsp;&lt;SPAN&gt;-0.031327867107 is the rate of decline in units of GFR per day.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1631303878859.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63500i094FFBE833C4B6B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1631303878859.png" alt="Sajid01_0-1631303878859.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_1-1631303945486.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63501i3F24E8E7678B4EBA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_1-1631303945486.png" alt="Sajid01_1-1631303945486.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 19:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Estimating-the-rate-of-decline-in-a-variable-over-time/m-p/767111#M243158</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-09-10T19:59:30Z</dc:date>
    </item>
  </channel>
</rss>

