<?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: Selecting MAX VALUE by visit number in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2848#M233</link>
    <description>That works! Thanks very much!!!</description>
    <pubDate>Thu, 19 Apr 2007 15:06:46 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-04-19T15:06:46Z</dc:date>
    <item>
      <title>Selecting MAX VALUE by visit number</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2846#M231</link>
      <description>I have the following data:&lt;BR /&gt;
&lt;BR /&gt;
id visit# score &lt;BR /&gt;
1   00       5        &lt;BR /&gt;
1   02       7         &lt;BR /&gt;
1   04       3         &lt;BR /&gt;
2   00       2         &lt;BR /&gt;
2   02       1         &lt;BR /&gt;
2   04       8         &lt;BR /&gt;
&lt;BR /&gt;
How do I get the variable "maxscore" to display the maximum score up until that visit, looking at also previous ones? It should look something like this:&lt;BR /&gt;
&lt;BR /&gt;
id visit# score maxscore&lt;BR /&gt;
1   00       5         5&lt;BR /&gt;
1   02       7         7&lt;BR /&gt;
1   04       3         7&lt;BR /&gt;
2   00       2         2&lt;BR /&gt;
2   02       1         2  &lt;BR /&gt;
2   04       8         8&lt;BR /&gt;
&lt;BR /&gt;
What is the SAS code that I need to get the table above? &lt;BR /&gt;
Thank you very much!</description>
      <pubDate>Wed, 18 Apr 2007 15:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2846#M231</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-04-18T15:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting MAX VALUE by visit number</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2847#M232</link>
      <description>Just try the following code, I hope it will work for u.&lt;BR /&gt;
&lt;BR /&gt;
data b;&lt;BR /&gt;
set a;&lt;BR /&gt;
retain score1 maxsc;&lt;BR /&gt;
by id;&lt;BR /&gt;
if first.id then score1=0;&lt;BR /&gt;
maxsc=max(score,score1);&lt;BR /&gt;
score1=maxsc;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
S.S.N.Ravi.</description>
      <pubDate>Thu, 19 Apr 2007 10:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2847#M232</guid>
      <dc:creator>SSN_Ravi</dc:creator>
      <dc:date>2007-04-19T10:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting MAX VALUE by visit number</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2848#M233</link>
      <description>That works! Thanks very much!!!</description>
      <pubDate>Thu, 19 Apr 2007 15:06:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Selecting-MAX-VALUE-by-visit-number/m-p/2848#M233</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-04-19T15:06:46Z</dc:date>
    </item>
  </channel>
</rss>

