<?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: Find maximum value from year 0 to year t continuously in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/675328#M280560</link>
    <description>&lt;P&gt;Thanks Shmuel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;absolutely helped me with my problem of continuous updating maximums over time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wes&lt;/P&gt;</description>
    <pubDate>Fri, 07 Aug 2020 22:52:17 GMT</pubDate>
    <dc:creator>uopsouthpaw</dc:creator>
    <dc:date>2020-08-07T22:52:17Z</dc:date>
    <item>
      <title>Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419904#M280544</link>
      <description />
      <pubDate>Thu, 04 Jun 2020 00:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419904#M280544</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2020-06-04T00:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419907#M280545</link>
      <description>&lt;P&gt;You can use PROC MEANS with option:&amp;nbsp;&lt;STRONG&gt; max = maxATQ&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;and&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CLASS&amp;nbsp;&lt;SPAN&gt;company ID;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;VAR ATq;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;WHERE&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt; datadate between &amp;lt;date created&amp;gt; and &amp;lt;current date&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 11:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419907#M280545</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-10T11:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419911#M280546</link>
      <description>&lt;P&gt;Thank you, I tried but it didn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is:&lt;/P&gt;&lt;P&gt;proc means data=practice;&lt;/P&gt;&lt;P&gt;max(atq)= max_atq;&lt;/P&gt;&lt;P&gt;class GVKEY;&lt;/P&gt;&lt;P&gt;var atq;&lt;/P&gt;&lt;P&gt;where datadate between &amp;lt;date created&amp;gt; and &amp;lt;current date&amp;gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont understand the part &amp;lt;date created&amp;gt; and &amp;lt;current date&amp;gt;. What am I supposed to put into &amp;lt;date created&amp;gt; and &amp;lt;current date&amp;gt;? Because each company has different beginning date. Company 1 data begins at 31/3/1983, company 2 begins at 31/3/1982&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 12:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419911#M280546</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-10T12:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419912#M280547</link>
      <description>&lt;P&gt;Assuming company created date is the lowest value of datadate and current date is the latest one - then you can&amp;nbsp;&lt;/P&gt;
&lt;P&gt;just ignore and cancel the where clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did the code worked after removing the where statement ?&lt;/P&gt;
&lt;P&gt;if negative - explain what happend and post the log.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 12:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419912#M280547</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-10T12:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419916#M280548</link>
      <description>&lt;P&gt;It still doesnt work when I remove the where statement&lt;/P&gt;&lt;P&gt;The log file below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data practice;&lt;BR /&gt;set 'c:\mysaslib\firms.sas7bdat';&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 1522473 observations read from the data set c:\mysaslib\firms.sas7bdat.&lt;BR /&gt;NOTE: The data set WORK.PRACTICE has 1522473 observations and 25 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.35 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.35 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;138&amp;nbsp; proc means data=practice;&lt;BR /&gt;139&amp;nbsp; max(atq)=max_atq;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 180&lt;BR /&gt;&lt;STRONG&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/STRONG&gt;&lt;BR /&gt;140&amp;nbsp; class GVKEY;&lt;BR /&gt;141&amp;nbsp; var atq;&lt;BR /&gt;142&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 13:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419916#M280548</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-10T13:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419921#M280549</link>
      <description>&lt;P&gt;Try next code with the right syntax:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=practice  ;
  output out=want    max(atq)=max_atq;
  class GVKEY;
  var atq;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Dec 2017 13:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419921#M280549</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-10T13:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419922#M280550</link>
      <description>&lt;P&gt;Hi. It works but it produces the maximum value of each company for the entire date range, which is not what I need to do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the problem is: for each company i:&lt;/P&gt;&lt;P&gt;at t=1: I need to find the maximum value of ATQ from t=0 to t=1&lt;/P&gt;&lt;P&gt;at t=2: Max ATQ from t=0 to t=2&lt;/P&gt;&lt;P&gt;at t=3: Max ATQ from t=0 to t=3&lt;/P&gt;&lt;P&gt;and so on .....&lt;/P&gt;&lt;P&gt;at t=T: Max ATQ from t=0 to t=T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically the date range (to find max value) expands when time progress. And I need to find different maximum values of ATQ corresponding with different time range (0 to 1, 0 to 2, 0 to 3, ...... , 0 to T)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I need to do some kind of loop?. But I can not find any information on how to do it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 14:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419922#M280550</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-10T14:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419924#M280551</link>
      <description>&lt;P&gt;What do you mean by t= ?&lt;/P&gt;
&lt;P&gt;Is it - first year, first 2 years, first 3 years etc ?&lt;/P&gt;
&lt;P&gt;If positive then the use of a data step will be more usefull then proc means:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=practice; by GVKEY datadate; run;
data temp;
        year = year(datadate);
run;
data want;
 set temp;
   by gvkey year;
        retain maxATQ;
        if first.gvkey then maxATQ = ATQ; 
        maxATQ = max(maxATQ, ATQ);
       if last.year then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Dec 2017 14:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419924#M280551</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-10T14:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419925#M280552</link>
      <description>Yes, that's exacly what I mean.&lt;BR /&gt;&lt;BR /&gt;I need to find maximum value in the first year, first 2 years, first 3 years .... and finally the entire time range.&lt;BR /&gt;&lt;BR /&gt;Thank you for giving me some clue. I will try it and give you some feedback as soon as possible</description>
      <pubDate>Sun, 10 Dec 2017 14:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419925#M280552</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-10T14:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419945#M280553</link>
      <description>&lt;P&gt;It's a little puzzling what you are looking for, since you don't actually illustrate what the outcome should be.&amp;nbsp; You describe the problem in terms of years.&amp;nbsp; But the date values you use to illustrate are quarters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your data set is in order by GVKEY DATADATE, here is a program that may help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by gvkey;&lt;/P&gt;
&lt;P&gt;if first.gvkey then max_atq = atq;&lt;/P&gt;
&lt;P&gt;else max_atq = max(max_atq, atq);&lt;/P&gt;
&lt;P&gt;retain max_atq;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you can have many observations per DATADATE.&amp;nbsp; But the MAX_ATQ value is the max found so far.&amp;nbsp; Therefore, it can be different for two observations having the same DATADATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program will move you in the right direction.&amp;nbsp; To make the requirements clearer, you will need to provide easier to read data, and a sample of what you picture the result to be (especially when you have two identical DATADATE values for the same GVKEY).&amp;nbsp; Then you can get a better suggested solution.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 18:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/419945#M280553</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-10T18:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420005#M280554</link>
      <description>&lt;P&gt;Hi astounding and shmuel. Your code works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But Now I have to calculate standard deviation of variable X from quarter I/1983 to quarter II/1983, and then quarter I/1983 to quarter III/1983, and so on.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It just like before:&lt;/P&gt;&lt;P&gt;at t=1, I need to find standard deviation of X from t=0 to t=1&lt;/P&gt;&lt;P&gt;at t=2, std of X from t=0 to t=2&lt;/P&gt;&lt;P&gt;and so on,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any idea how to do this? Because the previous code could not applied in this case&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 05:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420005#M280554</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T05:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420101#M280555</link>
      <description>&lt;P&gt;I just posted a sample of my dataset. So could anyone help me please?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420101#M280555</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2017-12-11T13:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420116#M280556</link>
      <description>&lt;P&gt;Maybe there are some economical or statistical procedures that I'm not familiar with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the same logic as in computing the maxATQ in order to calculate the standard deviation&lt;/P&gt;
&lt;P&gt;using its formula which I dont remeber exactly, that is something like:&lt;/P&gt;
&lt;P&gt;- retain&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;sum_x&lt;/STRONG&gt; - sum of variable&amp;nbsp; x&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;sum_sqr_x&amp;nbsp;&lt;/STRONG&gt;- sum the squares of variable x&lt;/P&gt;
&lt;P&gt;- then compute the STD using those sums retained and _N_ as cumulative number of observations&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have one observation per qurter then just output each with the last computed values.&lt;/P&gt;
&lt;P&gt;if you want comulative per whole years - output it on&lt;STRONG&gt; last.year&lt;/STRONG&gt; - as in my post for maxATQ.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 14:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420116#M280556</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-11T14:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420175#M280557</link>
      <description>&lt;P&gt;you might adapt a solution I offered earlier&amp;nbsp;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/td-p/420065/jump-to/first-unread-message&amp;nbsp;" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/td-p/420065/jump-to/first-unread-message&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;That delivered progressively, the STD() for a number stream within each company, over time&lt;/P&gt;
&lt;P&gt;Looks like your task is quite similar&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420175#M280557</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-11T16:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420177#M280558</link>
      <description>&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/td-p/420065/jump-to/first-unread-message" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/Estimate-standard-deviation-quarter-by-quarter/td-p/420065/jump-to/first-unread-message&lt;/A&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420177#M280558</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-12-11T16:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420238#M280559</link>
      <description>&lt;P&gt;The mean can be calculated by keeping track of the sum and N, accumulating as you go.&amp;nbsp; In similar fashion, standard deviation can be written as a function of N, sum, and sum of squared values.&amp;nbsp; If you accumulate all three pieces, you can use the same approach and calculate standard deviation at each point along the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/420238#M280559</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-11T18:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/675328#M280560</link>
      <description>&lt;P&gt;Thanks Shmuel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;absolutely helped me with my problem of continuous updating maximums over time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wes&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 22:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/675328#M280560</guid>
      <dc:creator>uopsouthpaw</dc:creator>
      <dc:date>2020-08-07T22:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Find maximum value from year 0 to year t continuously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/675355#M280561</link>
      <description>&lt;P&gt;For each GVKEY you want maximum ATQ for the entire history of the company through the current DATADATE.&amp;nbsp; Since you are using ATQ, you must be using Compustat quarterly data, correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data is probably already sorted by gvkey/datadate.&amp;nbsp; If so, then&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set practice;
  by gvkey datadate;
  retain max_atq;
  if first.gvkey then max_atq=atq;
  else max_atq=max(max_atq,atq);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I use "by gvkey datadate", even though I only need "by gvkey".&amp;nbsp; I threw in the datadate variable just to obligate SAS to report if data are out of order.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For almost all of your results, the DATADATEs within a gvkey will be separated by exactly 3 months, based on whatever month the company uses to end its fiscal year.&amp;nbsp; HOWEVER, you can sometimes get shorter intervals, when a company changes its fiscal year.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2020 04:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-maximum-value-from-year-0-to-year-t-continuously/m-p/675355#M280561</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-08-08T04:55:20Z</dc:date>
    </item>
  </channel>
</rss>

