<?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: problems with the lag() function in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1035#M64</link>
    <description>Hi Jean-Sebastien,&lt;BR /&gt;
&lt;BR /&gt;
Try something like this (not tested):&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  merge fruits fruits (firstobs=2 rename=(fruit=fruit1));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps,&lt;BR /&gt;
   Nancy</description>
    <pubDate>Thu, 13 Jul 2006 22:22:26 GMT</pubDate>
    <dc:creator>Nancy_B</dc:creator>
    <dc:date>2006-07-13T22:22:26Z</dc:date>
    <item>
      <title>problems with the lag() function</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1034#M63</link>
      <description>Hi, &lt;BR /&gt;
   here's my problem: I want to compare an observation in the second row with an observation in the first row. E.g :&lt;BR /&gt;
   fruit  Fruit1 (I want to create that variable)&lt;BR /&gt;
1  orange apple&lt;BR /&gt;
2  apple  banana&lt;BR /&gt;
3  banana&lt;BR /&gt;
&lt;BR /&gt;
I know with the LAG() function you can compare with the next row. Is there any function doing the same thing but with the  previous row??&lt;BR /&gt;
&lt;BR /&gt;
thanks,&lt;BR /&gt;
&lt;BR /&gt;
Jean-Sebastien</description>
      <pubDate>Wed, 12 Jul 2006 14:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1034#M63</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-07-12T14:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: problems with the lag() function</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1035#M64</link>
      <description>Hi Jean-Sebastien,&lt;BR /&gt;
&lt;BR /&gt;
Try something like this (not tested):&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  merge fruits fruits (firstobs=2 rename=(fruit=fruit1));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps,&lt;BR /&gt;
   Nancy</description>
      <pubDate>Thu, 13 Jul 2006 22:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1035#M64</guid>
      <dc:creator>Nancy_B</dc:creator>
      <dc:date>2006-07-13T22:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: problems with the lag() function</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1036#M65</link>
      <description>In SAS there is no lead function.  You could reverse sort your data and then use the lag function or you could create your own code to mimic the lead function:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Eaxample:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Data Have ;&lt;BR /&gt;
Infile Cards ;&lt;BR /&gt;
Input ID Fruit $ ;&lt;BR /&gt;
Cards ;&lt;BR /&gt;
1 Apple&lt;BR /&gt;
2 Orange&lt;BR /&gt;
3 Banana&lt;BR /&gt;
;&lt;BR /&gt;
Run ;&lt;BR /&gt;
&lt;BR /&gt;
Data Need ;&lt;BR /&gt;
Set Have NObs = NObs End = EOF ;&lt;BR /&gt;
&lt;BR /&gt;
MyPoint = _N_ + 1 ;&lt;BR /&gt;
&lt;BR /&gt;
If ( MyPoint &amp;lt;= NObs ) Then Do ;&lt;BR /&gt;
  Set Have ( Keep = Fruit Rename = ( Fruit = OldFruit ) ) Point = MyPoint ;&lt;BR /&gt;
End ;&lt;BR /&gt;
&lt;BR /&gt;
If Eof Then Call Missing( OldFruit ) ;&lt;BR /&gt;
&lt;BR /&gt;
Run ;&lt;BR /&gt;
&lt;BR /&gt;
Proc Print&lt;BR /&gt;
 Data = Need ;&lt;BR /&gt;
Run ;</description>
      <pubDate>Tue, 17 Oct 2006 16:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/problems-with-the-lag-function/m-p/1036#M65</guid>
      <dc:creator>TobyDunn_hotmail_com</dc:creator>
      <dc:date>2006-10-17T16:02:16Z</dc:date>
    </item>
  </channel>
</rss>

