<?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 Evaluate row but date on different row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595224#M171194</link>
    <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ln $ step $ date1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0122 B 01jun2019&lt;/P&gt;
&lt;P&gt;0122 B 07jun2019&lt;/P&gt;
&lt;P&gt;0122 C 06jun2019&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; step='B' &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b_step=date1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; step='C' &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; c_step=date1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b_step c_step &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;mmddyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE width="290"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="36"&gt;ln&lt;/TD&gt;
&lt;TD width="32"&gt;step&lt;/TD&gt;
&lt;TD width="70"&gt;date1&lt;/TD&gt;
&lt;TD width="76"&gt;b_step&lt;/TD&gt;
&lt;TD width="76"&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;The above query produces this output.&amp;nbsp; The issue is I need to evaluate both the date in b_step and c_step however as you can they are on different rows because there was no C step on the other dates.&amp;nbsp; Since there is not way to evaluate rows unless they are on the same row, is there a way to program the code to get the c_step date on the same row as the b_step.&amp;nbsp; So 6/6/2019 in c_step would move to the top row.&amp;nbsp; If not then is there a way to evaluate b_step and c_step in its current condition (ie if b_step and c_step &amp;gt;0 then F= 'Yes' ;else F='No';&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 00:55:11 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2019-10-10T00:55:11Z</dc:date>
    <item>
      <title>Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595224#M171194</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ln $ step $ date1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0122 B 01jun2019&lt;/P&gt;
&lt;P&gt;0122 B 07jun2019&lt;/P&gt;
&lt;P&gt;0122 C 06jun2019&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; step='B' &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b_step=date1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; step='C' &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; c_step=date1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b_step c_step &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;mmddyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;TABLE width="290"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="36"&gt;ln&lt;/TD&gt;
&lt;TD width="32"&gt;step&lt;/TD&gt;
&lt;TD width="70"&gt;date1&lt;/TD&gt;
&lt;TD width="76"&gt;b_step&lt;/TD&gt;
&lt;TD width="76"&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;The above query produces this output.&amp;nbsp; The issue is I need to evaluate both the date in b_step and c_step however as you can they are on different rows because there was no C step on the other dates.&amp;nbsp; Since there is not way to evaluate rows unless they are on the same row, is there a way to program the code to get the c_step date on the same row as the b_step.&amp;nbsp; So 6/6/2019 in c_step would move to the top row.&amp;nbsp; If not then is there a way to evaluate b_step and c_step in its current condition (ie if b_step and c_step &amp;gt;0 then F= 'Yes' ;else F='No';&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 00:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595224#M171194</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-10-10T00:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595227#M171196</link>
      <description>&lt;P&gt;Check next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input ln $ step $ date1 date9.;
format date1 date9.;
datalines;
0122 B 01jun2019
0122 B 07jun2019
0122 C 06jun2019
;
run;

data test2;
 set test;
  by ln ;
      retain _all_;
     if step='B' then b_step=date1;
     if step='C' then c_step=date1;

     if last.ln then do; &lt;SPAN&gt;if b_step and c_step &amp;gt;0 then F= 'Yes' ;else F='No'; &lt;/SPAN&gt;output; end;&lt;BR /&gt;     
     keep ln b_step c_step F;
     format b_step c_step mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 01:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595227#M171196</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-10-10T01:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595228#M171197</link>
      <description>&lt;P&gt;I don't fully understand your description of what you want.&amp;nbsp; Please post what the resulting data would actually look like.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 01:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595228#M171197</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-10T01:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595230#M171198</link>
      <description>&lt;P&gt;Your solution puts the c_step on the top row however this is the actual output desired&lt;/P&gt;
&lt;TABLE width="290"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="138" colspan="3"&gt;Original output&lt;/TD&gt;
&lt;TD width="76"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="76"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ln&lt;/TD&gt;
&lt;TD&gt;step&lt;/TD&gt;
&lt;TD&gt;date1&lt;/TD&gt;
&lt;TD&gt;b_step&lt;/TD&gt;
&lt;TD&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD colspan="3"&gt;Desired Output&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ln&lt;/TD&gt;
&lt;TD&gt;step&lt;/TD&gt;
&lt;TD&gt;date1&lt;/TD&gt;
&lt;TD&gt;b_step&lt;/TD&gt;
&lt;TD&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Idea is to show c_step on same row as the B_step so I can evaluate borizontally.&amp;nbsp; By nature the steps will have different rows due to different step names "B" and "C"&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 01:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595230#M171198</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-10-10T01:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595231#M171199</link>
      <description>&lt;TABLE width="290"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="138" colspan="3"&gt;Original output&lt;/TD&gt;
&lt;TD width="76"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="76"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ln&lt;/TD&gt;
&lt;TD&gt;step&lt;/TD&gt;
&lt;TD&gt;date1&lt;/TD&gt;
&lt;TD&gt;b_step&lt;/TD&gt;
&lt;TD&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD colspan="3"&gt;Desired Output&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ln&lt;/TD&gt;
&lt;TD&gt;step&lt;/TD&gt;
&lt;TD&gt;date1&lt;/TD&gt;
&lt;TD&gt;b_step&lt;/TD&gt;
&lt;TD&gt;c_step&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;01Jun2019&lt;/TD&gt;
&lt;TD&gt;06/01/2019&lt;/TD&gt;
&lt;TD&gt;06/06/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;07Jun2019&lt;/TD&gt;
&lt;TD&gt;06/07/2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0122&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;06Jun2019&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 01:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595231#M171199</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-10-10T01:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595242#M171205</link>
      <description>&lt;P&gt;Make a minor modification to the way you make dataset TEST.&amp;nbsp; Then it is straightforward:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input ln $ step $ date1 date9.;
  if step='B' then b_step=date1; else
  if step='C' then c_step=date1;
  format date1 b_step c_step date9.;
datalines;
0122 B 01jun2019
0122 B 07jun2019
0122 C 06jun2019
run;

data test2;
 merge test (where=(step='C') in=inc)
       test;
 by ln ;
 output;
 call missing(of _all_);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The MERGE statement merges the single step='C' record with all three records. &amp;nbsp; Ordinarily that means the variable C_STEP would be present in all 3 resulting records (because it's a one-to-many merge).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But because it uses an explicit OUTPUT statement followed by a CALL MISSING(of _ALL_), the C_STEP inserted into record 1 was set to missing and was not restored until it was re-read in the 3rd record.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 02:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595242#M171205</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-10T02:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595249#M171209</link>
      <description>&lt;P&gt;Much like in life, the SAS data step is good at "knowing the past" but not as good at "knowing the future" (it's just an analogy)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus, SAS has the LAG function, but not a LEAD function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I generally avoid LAG when a RETAIN works just as well, but that's just my coding style.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it's easy to use PROC SQL's Cartesian product plus a surrogate key to implement both LEAD and LAG:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input ln $ step $ date1 date9.;
format date1 date9.;
datalines;
0122 B 01jun2019
0122 B 07jun2019
0122 C 06jun2019
;
run;

data have/view=have;
   sk+1;
   set test;
run;

proc sql;
   create table want as
   select a.ln
         ,a.step
         ,a.date1
         ,b.date1 as date1_lag
         ,c.date1 as date1_lead
   from have a
   full join have b
   on a.ln=b.ln and a.sk=b.sk+1
   full join have c
   on a.ln=c.ln and a.sk+1=c.sk
   where a.ln is not missing
   ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are other approaches:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;double set statement with obs= ds options (and a lot of fiddling if you have to account for grouping columns)&lt;/LI&gt;
&lt;LI&gt;indexes + surrogate key (but requires the sk to be physically in the file)&lt;/LI&gt;
&lt;LI&gt;hash objects (does not require the sk to be in the file, you can use a view as I have done)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;but SQL + Cartesian + SK is my go-to approach as long as data volumes don't cause performance issues due to the Cartesian product.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH...&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 03:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595249#M171209</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-10-10T03:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595252#M171210</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would&amp;nbsp;argue that there really isn't a true LAG function in SAS either.&amp;nbsp; This misleadingly-named function should really be called something like UPDFIFOQ&amp;nbsp; or UFQ&amp;nbsp; (for "update fifo queue").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I bet using such queue-oriented nomenclature would not only reduce the frequent lament at the absence of&amp;nbsp;"LEAD" function, but would also enhance understanding when, how, and whether to use the function in an if statement.&amp;nbsp; And using the notion of updating queues would be a better fit for your observation that the "data step is good at knowing the past".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And of course, the data step can actually&amp;nbsp; look ahead about as easily as it can look back:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data past_present_future;
    merge have 
          have (firstobs=2 keep=x rename=(x=next_x));
    if _n_&amp;gt;1 then set have (keep=x rename=(x=past_x));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 04:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595252#M171210</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-10T04:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595259#M171211</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I would&amp;nbsp;argue that there really isn't a true LAG function in SAS either.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I dunno...it's listed in the doc as a function &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp; IIRC with a number of caveats - it's been a while since I read the doc on LAG and am too lazy to look it up right now.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;This misleadingly-named function should really be called something like UPDFIFOQ&amp;nbsp; or UFQ&amp;nbsp; (for "update fifo queue").&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SASWare Ballot? &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I just never really use LAG (LAG1 that is):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
   length lag_name $10;
   retain lag_name;
   lag_name=name;
   set sashelp.class;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Or perhaps:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class (keep=name age);
   by age name;
run;

data want;
   length lag_name $10;
   retain lag_name;
   lag_name=name;
   set class;
   by age name;
   if first.age then call missing(lag_name);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;But it gets more cumbersome the more grouping columns you have.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Things get trickier using this approach if I need LAG2, LAG3, etc, but I rarely have a need for that.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;And of course, the data step can actually&amp;nbsp; look ahead about as easily as it can look back:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data past_present_future;
    merge have 
          have (firstobs=2 keep=x rename=(x=next_x));
    if _n_&amp;gt;1 then set have (keep=x rename=(x=past_x));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Define "easily" lol.&amp;nbsp; I'll define it as "intuitively obvious to someone with less than 3 years SAS experience" (or easily found as an example in the doc).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you've shown a cool technique mixing merge and double set statement.&amp;nbsp; I've done something similar in the past using double (or triple) set statements, and the premature eof (firstobs=2) was problematic.&amp;nbsp; I can't remember what approach I used?&amp;nbsp; point=? do until eof?&amp;nbsp; Anyway, now I have your approach, so thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Standalone example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data past_present_future;
   format past_name name next_name;
   if _n_&amp;gt;1 then set sashelp.class (keep=name rename=(name=past_name));
   merge sashelp.class
         sashelp.class (firstobs=2 keep=name rename=(name=next_name));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, how would you do the below using your approach if you needed to group (without lots of first. and last. processing + call missings)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class (keep=name age);
   by age name;
run;

data have/view=have;
   sk+1;
   set class;
run;

proc sql;
   create table want as
   select b.name as past_name
         ,a.name
         ,c.name as next_name
         ,a.age
   from have a
   full join have b
   on a.age=b.age and a.sk=b.sk+1
   full join have c
   on a.age=c.age and a.sk+1=c.sk
   where a.name is not missing
   ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or worse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.cars out=cars (keep=make type model drivetrain);
   by make type drivetrain;
run;

data have/view=have;
   sk+1;
   set cars;
run;

proc sql;
   create table want as
   select b.model as past_model
         ,a.model
         ,c.model as next_model
         ,a.make
         ,a.type
         ,a.drivetrain
   from have a
   full join have b
   on a.make=b.make and a.type=b.type and a.drivetrain=b.drivetrain and a.sk=b.sk+1
   full join have c
   on a.make=b.make and a.type=b.type and a.drivetrain=b.drivetrain and a.sk+1=c.sk
   where a.model is not missing
   ;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I haven't done any in depth checking on this last example to see if the results make sense - they looked ok on a quick glance).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&amp;nbsp; I &lt;U&gt;have&lt;/U&gt; used your approach, or something similar, when performance was an issue.&amp;nbsp; Say 50M records, and I needed LEAD within say two grouping columns.&amp;nbsp; 50M * 50M * 50M Cartesian, even when filtered out with the join criteria, can be a bit of an "issue"!&amp;nbsp; But it required a bit of first. and last. processing plus call missing statements (and a lot of testing) to get the desired results.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 05:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595259#M171211</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-10-10T05:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595261#M171212</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;Please&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="4"&gt;&lt;FONT size="2"&gt;use the proper window ("little running man" button) for posting code. The main window mangles code, so it needs all kinds of cosmetic operations before it runs and looks good.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;FONT size="2"&gt;See this code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input ln $ step $ date1 date9.;
format date1 date9.;
datalines;
0122 B 01jun2019
0122 B 07jun2019
0122 C 06jun2019
;

data test2;
set test;
if step='B' then b_step=date1;
if step='C' then c_step=date1;
format b_step c_step mmddyy10.;
run;

data want;
if 0 then set test2;
call missing (of _all_);
merge
  test2 (drop=c_step)
  test2 (drop=step date1 b_step where=(c_step ne .));
;
by ln;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;FONT size="2"&gt;Result:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt; ln     step        date1        b_step        c_step

0122     B      01JUN2019    06/01/2019    06/06/2019
0122     B      07JUN2019    06/07/2019             .
0122     C      06JUN2019             .             .
&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 06:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595261#M171212</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-10T06:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate row but date on different row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595571#M171366</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;However, how would you do the below using your approach if you needed to group (without lots of first. and last. processing + call missings)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class (keep=name age);
   by age name;
run;

data have/view=have;
   sk+1;
   set class;
run;

proc sql;
   create table want as
   select b.name as past_name
         ,a.name
         ,c.name as next_name
         ,a.age
   from have a
   full join have b
   on a.age=b.age and a.sk=b.sk+1
   full join have c
   on a.age=c.age and a.sk+1=c.sk
   where a.name is not missing
   ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or worse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.cars out=cars (keep=make type model drivetrain);
   by make type drivetrain;
run;

data have/view=have;
   sk+1;
   set cars;
run;

proc sql;
   create table want as
   select b.model as past_model
         ,a.model
         ,c.model as next_model
         ,a.make
         ,a.type
         ,a.drivetrain
   from have a
   full join have b
   on a.make=b.make and a.type=b.type and a.drivetrain=b.drivetrain and a.sk=b.sk+1
   full join have c
   on a.make=b.make and a.type=b.type and a.drivetrain=b.drivetrain and a.sk+1=c.sk
   where a.model is not missing
   ;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I haven't done any in depth checking on this last example to see if the results make sense - they looked ok on a quick glance).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&amp;nbsp; I &lt;U&gt;have&lt;/U&gt; used your approach, or something similar, when performance was an issue.&amp;nbsp; Say 50M records, and I needed LEAD within say two grouping columns.&amp;nbsp; 50M * 50M * 50M Cartesian, even when filtered out with the join criteria, can be a bit of an "issue"!&amp;nbsp; But it required a bit of first. and last. processing plus call missing statements (and a lot of testing) to get the desired results.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, by-groups require the use of a BY statement.&amp;nbsp;&amp;nbsp; But that BY statement should be associated not with the MERGE or SET statements in my prior example, but&amp;nbsp; to an additional SET that reads in only the BY vars, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.cars out=cars (keep=make type model drivetrain);
   by make type drivetrain;
run;

data past_present_future;
   if _n_&amp;gt;1 then set cars (keep=model rename=(model=past_model));
   merge cars
         cars (firstobs=2 keep=model rename=(model=next_model));

   set cars (keep=make type drivetrain);
   by make type drivetrain;
   if first.drivetrain then call missing(of past_:);
   if last.drivetrain then call missing(of next_:);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is easily expanded to carry multiple PAST_ and NEXT_ variables, requiring only the addition of those variables (and associated RENAMEs) in the "IF ... THEN SET" statement and the 2nd argument of the MERGE statement.&amp;nbsp; Just make sure to use PAST_xxx and NEXT_xxx for the renamed variables, so that the CALL MISSING can be left unchanged.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not going to argue over "easily", but I do regard this code as relatively compact and straightforward.&amp;nbsp; Its fundamental requirement is a level of comfort with understanding how the DATA step builds the program-data-vector.&amp;nbsp; If only&amp;nbsp; SAS Institute had written more meaningful documentation on SET and MERGE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But my main point is that the DATA step need not be limited to "looking back".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 21:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-row-but-date-on-different-row/m-p/595571#M171366</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-10T21:39:17Z</dc:date>
    </item>
  </channel>
</rss>

