<?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: SAS lag and lead problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627904#M185447</link>
    <description>thank you!</description>
    <pubDate>Thu, 27 Feb 2020 13:57:48 GMT</pubDate>
    <dc:creator>harrylui</dc:creator>
    <dc:date>2020-02-27T13:57:48Z</dc:date>
    <item>
      <title>SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627801#M185405</link>
      <description>&lt;P&gt;good day,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is my program,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input name $40.;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;datalines;&lt;BR /&gt;A &lt;BR /&gt;AAAOTAXIUNION &lt;BR /&gt;AACARPETSDELHI &lt;BR /&gt;AADESIGNFURNZTURNSAMUTPRAKAN &lt;BR /&gt;AADRIVERTRAININGLTAUCKLAND &lt;BR /&gt;AAFOOTWEARCENTRALWORBANGKOK &lt;BR /&gt;AAFOOTWEARGAYSORNBANGKOK &lt;BR /&gt;AAFOOTWEAROUTLETAYUTTAYUTTHAYA &lt;BR /&gt;AAHONGKONG &lt;BR /&gt;AAMCLENNANGKMPOKOLBIN &lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data have2;&lt;BR /&gt;set have;&lt;BR /&gt;lag_name=lag(name);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i also want to add a lead Row here for comparison. can anyone help?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 08:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627801#M185405</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-02-27T08:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627803#M185407</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
    merge have
          have(firstobs=2 rename=(name=lead_name) keep=name);
    lag_name=lag(name);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 08:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627803#M185407</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-27T08:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627809#M185410</link>
      <description>NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;31         &lt;BR /&gt;32         GOPTIONS ACCESSIBLE;&lt;BR /&gt;33         &lt;BR /&gt;34         data have2;&lt;BR /&gt;35             merge have&lt;BR /&gt;36                   have(firstobs=2 rename=(name=lead_name) keep=name);&lt;BR /&gt;37             lag_name=lag(name);&lt;BR /&gt;38         run;&lt;BR /&gt;&lt;BR /&gt;ERROR: No BY statement was specified for a MERGE statement.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;not work</description>
      <pubDate>Thu, 27 Feb 2020 08:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627809#M185410</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-02-27T08:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627810#M185411</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107435"&gt;@harrylui&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you try the same code with the following option before:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Options mergeNoBy=noWarn ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 08:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627810#M185411</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T08:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627811#M185412</link>
      <description>&lt;P&gt;Please check that the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lesysoptsref&amp;amp;docsetTarget=n0hlv62ubu3fa6n1co02ezotijyo.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;MERGENOBY System Option&lt;/A&gt;&amp;nbsp;is set to NOWARN.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 08:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627811#M185412</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-27T08:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627904#M185447</link>
      <description>thank you!</description>
      <pubDate>Thu, 27 Feb 2020 13:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627904#M185447</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-02-27T13:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627905#M185448</link>
      <description>thank you! my problem is fixed!</description>
      <pubDate>Thu, 27 Feb 2020 13:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627905#M185448</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-02-27T13:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS lag and lead problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627909#M185450</link>
      <description>I always just reverse sort order and do lag(), this is WAY easier!</description>
      <pubDate>Thu, 27 Feb 2020 14:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-lag-and-lead-problem/m-p/627909#M185450</guid>
      <dc:creator>Krueger</dc:creator>
      <dc:date>2020-02-27T14:13:52Z</dc:date>
    </item>
  </channel>
</rss>

