<?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: row compare, if mismatch then get an email alert with row name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/669032#M200653</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename EMAIL email   ....   ;

data EMAIL;
  merge TEST (in=A) TEST1(in=B) ;
  by FILENAME;
  if ^(A &amp;amp; B);
  call execute('data _null_; set EMAIL; file EMAIL; put FILENAME; run;');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 00:54:33 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-07-14T00:54:33Z</dc:date>
    <item>
      <title>row compare, if mismatch then get an email alert with row name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/668868#M200553</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;Need to receive an email alert if one of the row missing.&lt;/P&gt;&lt;P&gt;if we look into below code.&lt;/P&gt;&lt;P&gt;e.txt is missing from test table so need to get an email with e.txt in the body.&lt;/P&gt;&lt;P&gt;done the proc compare but not sure how to read that missing row into a table and send that missing row to an email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards;
input filename $40.;
cards;
a.txt
c.txt
b.txt
d.txt
;
run;
proc sort data=test;
by filename;
run;

data test1;
infile cards;
input filename $40.;
cards;
a.txt
b.txt
d.txt
e.txt
c.txt

;
run;
proc sort data=test1;
by filename;
run;

proc  compare base=test compare=test1 LISTCOMPOBS;
run;
               &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 15:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/668868#M200553</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2020-07-13T15:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: row compare, if mismatch then get an email alert with row name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/669019#M200646</link>
      <description>&lt;P&gt;Import your data into sas and compare number of observations before any sort or datasets compare:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let need_mail = NO;
data _null_;
      dsid = open('work.test');
      if dsid then nobs1 = attrn(dsid,'nobs');
      dsid = close(dsid);
      
      dsid = open('work.test1');
      if dsid then nobs2 = attrn(dsid,'nobs');
      dsid = close(dsid);
      
      if nobs1 ne nobs2 then
         call symput('need_mail','YES');
run;

%macro send_mail(send_flag);
       %if &amp;amp;send_flag = YES %then %do;
             /* send non matching mail code */
               .........
       %end;
%mend send_mail;
%send_mail(&amp;amp;need_mail);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 23:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/669019#M200646</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-07-13T23:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: row compare, if mismatch then get an email alert with row name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/669032#M200653</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename EMAIL email   ....   ;

data EMAIL;
  merge TEST (in=A) TEST1(in=B) ;
  by FILENAME;
  if ^(A &amp;amp; B);
  call execute('data _null_; set EMAIL; file EMAIL; put FILENAME; run;');
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 00:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/row-compare-if-mismatch-then-get-an-email-alert-with-row-name/m-p/669032#M200653</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-07-14T00:54:33Z</dc:date>
    </item>
  </channel>
</rss>

