<?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 How to retrieve a single row from the output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329787#M73830</link>
    <description>&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;have a question related to the following code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Temp1, Temp2, Temp3, Temp4 are variables from dataset temp.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Ds1, ds2, ds3, ds4 are variables from the dataset2.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Code is the variable from temp and code has been renamed to _code1 in dataset2.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;For a particular records in temp the value of mid=1 and pid =6. It has a single match in dataset 2. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Temp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Code $ mid pid temp1 $ temp2 $ temp3 $ temp4 $;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: rgb(255, 255, 192); color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;AB 1 6 aaa bbb xxx yyy&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Dataset2;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Code $ ds1 $ ds2 $ ds3 $ ds4 $;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: rgb(255, 255, 192); color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;AB aaa bbb xxx yyy&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; two;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: green; font-family: &amp;quot;Courier New&amp;quot;;"&gt;* Drop temporary variables;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;DO&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; i=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;TO&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; xnobs;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; dataset2 (&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=(code=_code1)) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;NOBS&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=xnobs &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;POINT&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=i;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; code=_code1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; mid=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp1=ds1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp2 = ds2 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; m_match=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; pid =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;6&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp; temp3 = ds3 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp4=ds4 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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; p_match=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;The problem is when I run the below query the output has 2 rows where as I need one row in the output which has both m_match=’Y’ and p_match =’Y’. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Also if by any chance if the output has only one row with either p_match='Y' or m_match='Y', i need to retrieve that as well&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;It will be great if you can help me with this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Editing the message to add few more details&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Please find the output below&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="700" dir="LTR" border="0" cellspacing="0" cellpadding="2"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Code&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;mid&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;pid&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp4&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;uni_seq_num&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;_code1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds4&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;m_match&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;p_match&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;6&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;36111&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;6&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;36111&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing which i noticed is even though the conditions are matching (temp3=ds3 and temp4=ds4) p_match= set to blank. I am lil confused on this.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Thanks in advance,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Sheeba Swaminathan&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2017 16:28:48 GMT</pubDate>
    <dc:creator>Sheeba</dc:creator>
    <dc:date>2017-02-03T16:28:48Z</dc:date>
    <item>
      <title>How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329787#M73830</link>
      <description>&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;have a question related to the following code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Temp1, Temp2, Temp3, Temp4 are variables from dataset temp.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Ds1, ds2, ds3, ds4 are variables from the dataset2.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Code is the variable from temp and code has been renamed to _code1 in dataset2.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;For a particular records in temp the value of mid=1 and pid =6. It has a single match in dataset 2. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Temp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Code $ mid pid temp1 $ temp2 $ temp3 $ temp4 $;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: rgb(255, 255, 192); color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;AB 1 6 aaa bbb xxx yyy&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Dataset2;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; Code $ ds1 $ ds2 $ ds3 $ ds4 $;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: rgb(255, 255, 192); color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;AB aaa bbb xxx yyy&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; two;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: green; font-family: &amp;quot;Courier New&amp;quot;;"&gt;* Drop temporary variables;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;DO&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; i=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;TO&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; xnobs;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; dataset2 (&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=(code=_code1)) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;NOBS&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=xnobs &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;POINT&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;=i;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; code=_code1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; mid=&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp1=ds1 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp2 = ds2 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; m_match=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; pid =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: teal; font-family: &amp;quot;Courier New&amp;quot;;"&gt;6&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp; temp3 = ds3 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt; temp4=ds4 &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;then&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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; p_match=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: &amp;quot;Courier New&amp;quot;;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&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;&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&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: &amp;quot;Courier New&amp;quot;;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;SPAN style="background: white; color: navy; font-family: &amp;quot;Courier New&amp;quot;;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;;"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;The problem is when I run the below query the output has 2 rows where as I need one row in the output which has both m_match=’Y’ and p_match =’Y’. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Also if by any chance if the output has only one row with either p_match='Y' or m_match='Y', i need to retrieve that as well&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;It will be great if you can help me with this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Editing the message to add few more details&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Please find the output below&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="700" dir="LTR" border="0" cellspacing="0" cellpadding="2"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Code&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;mid&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;pid&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;temp4&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;uni_seq_num&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;_code1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;ds4&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;m_match&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;p_match&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;6&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;36111&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="6%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;6&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="7%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="14%" height="19"&gt;
&lt;P align="RIGHT"&gt;&lt;FONT face="Calibri" size="3"&gt;36111&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="8%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;AB&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;aaa&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="5%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;bbb&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;xxx&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="4%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;yyy&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="10%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="9%" height="19"&gt;
&lt;P align="LEFT"&gt;&lt;FONT face="Calibri" size="3"&gt;Y&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing which i noticed is even though the conditions are matching (temp3=ds3 and temp4=ds4) p_match= set to blank. I am lil confused on this.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Thanks in advance,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;Sheeba Swaminathan&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 16:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329787#M73830</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2017-02-03T16:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329789#M73831</link>
      <description>&lt;P&gt;I am really not sure here what you ar trying to do. &amp;nbsp;From what I can work out of your post, then this:&lt;/P&gt;
&lt;PRE&gt;data two;
  merge temp dataset2;
  by code;
  m_match=ifc(temp1=ds1 and temp2=ds2,"Y","");
  p_match=ifc(temp3=ds3 and temp4=ds4,"Y","");
run;&lt;/PRE&gt;
&lt;P&gt;Should be all you need. &amp;nbsp;If there is multiple rows, then retain m_match and p_match and if last.code then output? &amp;nbsp;Maybe clearly explain what you mean, update test data to reflect the scenarios, and provide what the output from that data should be. &amp;nbsp;It maybe you can simply use exists() function in SQL.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 13:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329789#M73831</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-03T13:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329790#M73832</link>
      <description>&lt;P&gt;Only execute the OUTPUT statement once if you only want to write one record. &amp;nbsp;So your program flow should be.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Calculate FLAG1 ;
Calculate FLAG2 ;
IF FLAG1 and FLAG2 then output;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In general I find it much easier to code if I use boolean values instead of characters strings. &amp;nbsp;For this type of problem initialize&amp;nbsp;the flags to false and then set true when your condition is matched.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;m_match=0;
p_match=0;
if code=_code1 then do;
  if mid=1 and temp1=ds1 and temp2=ds2 then m_match=1;
  if pid =6 and temp3=ds3 and temp4=ds4 then p_match=1;
end;
if m_match and p_match then output;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also it really seems your program is way too complicated. &amp;nbsp;If you want to merge on the value of CODE then just use the MERGE statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  merge temp dataset2 ;
  by code ;
  if  (mid=1 and temp1=ds1 and temp2=ds2)
  and (pid=6 and temp3=ds3 and temp4=ds4)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2017 14:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329790#M73832</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-02-03T14:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329794#M73835</link>
      <description>&lt;P&gt;And if no rows match on both, but you have one row with m_match='Y' and a different row with p_match='Y', do you want to output both of them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any of this can be done with a program that builds on the RW9 solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;m_match=' ';&lt;/P&gt;
&lt;P&gt;p_match=' ';&lt;/P&gt;
&lt;P&gt;do until (last.code);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;merge temp dataset2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;m_match=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;p_match=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;* Track the combinations found;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;* Check the combinations found and decide which combinations should be output;&lt;/P&gt;
&lt;P&gt;do until (last.code);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;merge temp dataset2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;m_match=&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;p_match=&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if /* right combination is found */ then output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 14:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329794#M73835</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-03T14:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329806#M73840</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is that the join is many to many and hence match merge is not giving exact results. I will try to add the data to reflect actual scenarios.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 15:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329806#M73840</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2017-02-03T15:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve a single row from the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329807#M73841</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks a lot for the reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will modify the flags.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem here is join is many to many and match merge doesnt' have expected results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sheeba&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 15:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-retrieve-a-single-row-from-the-output/m-p/329807#M73841</guid>
      <dc:creator>Sheeba</dc:creator>
      <dc:date>2017-02-03T15:08:20Z</dc:date>
    </item>
  </channel>
</rss>

