<?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: Identify third variable through two variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185556#M47117</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A Proc SQL alternative if your data is not too big: (raw data stoled from Ksharp):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;expandtabs&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; OrderID Shipped&amp;nbsp; Paid&amp;nbsp; date : &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/4/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/6/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/8/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; *, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;exists&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; shipped =&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; orderid=a.orderid &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a.paid=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;having&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; min(date) &amp;lt; a.date) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; completed&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a.orderid, a.date, a.paid&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Nov 2014 15:57:35 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2014-11-25T15:57:35Z</dc:date>
    <item>
      <title>Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185554#M47115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the following file, I need to identify any "Paid" that happens after the first "Shipped", in terms of both order and time.&amp;nbsp; For example, for OrderID#1, the third record counts as it occurs after at least one shipment takes place. OrderID#2 does not have any record that counts because "Paid" cannot happen on the same day as "Shipped". For OrderID#4, its third record counts as "Paid" is supposed to occur after at least one "Shipped" and it needs be on the days after "Shipped". The last column "&lt;SPAN style="color: #0000ff;"&gt;Completed&lt;/SPAN&gt;" is my target.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 320px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;OrderID&lt;/TD&gt;&lt;TD width="64"&gt;Shipped&lt;/TD&gt;&lt;TD width="64"&gt;Paid&lt;/TD&gt;&lt;TD width="64"&gt;date&lt;/TD&gt;&lt;TD width="64"&gt;&lt;SPAN style="color: #0000ff;"&gt;Completed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/1/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/2/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/5/2014&lt;/TD&gt;&lt;TD align="right" style="font-size: 11pt; color: #9c0006; font-family: Calibri; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/2/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/4/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/5/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/6/2014&lt;/TD&gt;&lt;TD align="right" style="font-size: 11pt; color: #9c0006; font-family: Calibri; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1/8/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;4&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;2/2/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;4&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;2/2/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;4&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;2/5/2014&lt;/TD&gt;&lt;TD align="right" style="font-size: 11pt; color: #9c0006; font-family: Calibri; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;4&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;2/6/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a bunch!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lizi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 13:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185554#M47115</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2014-11-25T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185555#M47116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why 4 shouldn't be&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="64"&gt;OrderID&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="64"&gt;Shipped&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="64"&gt;Paid&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="64"&gt;date&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="64"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;Completed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/1/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/2/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/5/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-size: 11pt; font-family: Calibri; color: #9c0006; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/2/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/4/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;3&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/5/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;3&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/6/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-size: 11pt; font-family: Calibri; color: #9c0006; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;3&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1/8/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/2/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;2/2/2014&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/5/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-size: 11pt; font-family: Calibri; color: #9c0006; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;4&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;1&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;2/6/2014&lt;/TD&gt;&lt;TD align="right" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;

data have;
infile cards expandtabs truncover;
input OrderID Shipped&amp;nbsp; Paid&amp;nbsp; date : mmddyy10.;
format date mmddyy10.;
cards;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/1/2014
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/2/2014
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/5/2014
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/2/2014
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/4/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/5/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/6/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/8/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2/2/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2/2/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2/5/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2/6/2014
;
run;
data want;
 set have;
 by&amp;nbsp; OrderID;
 retain found flag .;
 if first.OrderID then do;found=.; flag=.;end;
 if found and Paid and not flag then do;Completed=1; flag=1; end;
&amp;nbsp; else Completed=0;
 if Shipped then found=1;
 drop found flag;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 14:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185555#M47116</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-25T14:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185556#M47117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A Proc SQL alternative if your data is not too big: (raw data stoled from Ksharp):&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;expandtabs&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; OrderID Shipped&amp;nbsp; Paid&amp;nbsp; date : &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/4/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/6/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/8/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/5/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/2014&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; *, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;exists&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; shipped =&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; orderid=a.orderid &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a.paid=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;having&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; min(date) &amp;lt; a.date) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; completed&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a.orderid, a.date, a.paid&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 15:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185556#M47117</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-25T15:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185557#M47118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much, Keshan! But I realized that the time issue is not taken care of in your program. I have to consider both order and time. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 17:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185557#M47118</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2014-11-25T17:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185558#M47119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, Kuo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your way is pretty intuitive to me as I am still more familiar with small datahase management than the SAS retain function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 17:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185558#M47119</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2014-11-25T17:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185559#M47120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just realize Shipped and Paid should not be the same day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
infile cards expandtabs truncover;
input OrderID Shipped&amp;nbsp; Paid&amp;nbsp; date : mmddyy10.;
format date mmddyy10.;
cards;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/2014
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/4/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/6/2014
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/8/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/5/2014
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/2014
;
run;
data want;
 set have;
 by&amp;nbsp; OrderID;
 retain found flag _date .;
 if first.OrderID then do;found=.; flag=.;_date=.;end;
 if found and Paid and not flag and date ne _date then do;Completed=1; flag=1; end;
&amp;nbsp; else Completed=0;
 if Shipped then do;found=1;_date=date;end;
 drop found flag _date;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 12:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185559#M47120</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-26T12:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185560#M47121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keshan, it is more the matter of combination of timing and order than timing only or order only. Say if I have OrderID#5 that has the following shipping and payment timing, the program above would not be able to catch this order (Completed=0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" style="font-style: inherit;" width="64"&gt;OrderID&lt;/TD&gt;&lt;TD style="font-style: inherit;" width="64"&gt;Shipped&lt;/TD&gt;&lt;TD style="font-style: inherit;" width="64"&gt;Paid&lt;/TD&gt;&lt;TD style="font-style: inherit;" width="64"&gt;date&lt;/TD&gt;&lt;TD width="64"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;Completed&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;6/3/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;6/5/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;6/5/2014&lt;/TD&gt;&lt;TD align="right" style="font-size: 11pt; color: #9c0006; font-family: Calibri; background: #ffc7ce;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;6/5/2014&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, as you can see, Order #5 does have Completed=1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In sum, I am looking for the record per order that indicates "Paid" occurs after (both in terms of order and time) at least one "Shipped" takes place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 17:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185560#M47121</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2014-11-26T17:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185561#M47122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is more complicated than I image .This time could work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards expandtabs truncover;&lt;/P&gt;&lt;P&gt;input OrderID Shipped&amp;nbsp; Paid&amp;nbsp; date : mmddyy10.;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;cards;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/2014&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/2/2014&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/4/2014&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/5/2014&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/6/2014&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/8/2014&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/2/2014&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/5/2014&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2/6/2014&lt;/P&gt;&lt;P&gt;5 1 0 6/3/2014&lt;/P&gt;&lt;P&gt;5 1 0 6/5/2014&lt;/P&gt;&lt;P&gt;5 1 1 6/5/2014&lt;/P&gt;&lt;P&gt;5 1 0 6/5/2014&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set have;&lt;/P&gt;&lt;P&gt; by&amp;nbsp; OrderID;&lt;/P&gt;&lt;P&gt; retain found flag _date .;&lt;/P&gt;&lt;P&gt; if first.OrderID then do;found=.; flag=.;_date=.;end;&lt;/P&gt;&lt;P&gt; if found and Paid and not flag and date ne _date then do;Completed=1; flag=1; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else Completed=0;&lt;/P&gt;&lt;P&gt; if &lt;STRONG&gt;not found&lt;/STRONG&gt; and Shipped then do;found=1;_date=date;end;&lt;/P&gt;&lt;P&gt; drop found flag _date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Nov 2014 12:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185561#M47122</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-27T12:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Identify third variable through two variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185562#M47123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you got it right. Thank you for spending so much time, Keshan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Nov 2014 16:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identify-third-variable-through-two-variable/m-p/185562#M47123</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2014-11-30T16:54:27Z</dc:date>
    </item>
  </channel>
</rss>

