<?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: Send Email if Nobs - if not, dont. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473039#M121339</link>
    <description>&lt;P&gt;Nice, I had never thought of using the set that way.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 15:15:32 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-06-25T15:15:32Z</dc:date>
    <item>
      <title>Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473012#M121334</link>
      <description>&lt;P&gt;Hi. Ive made a macro that should send an email of there are observations in the dataset control.&lt;/P&gt;&lt;P&gt;Unfortunately it doens't wok. Can some of you guys see what im doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;doit&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(open(Control));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; NObs=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(attrn(&amp;amp;id,NOBS));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%syscall&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; set(id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;NObs;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rc=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(fetchobs(&amp;amp;id,&amp;amp;i));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename mymail email&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;subject=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Risk Control IRK: Violation in HQLA Concentration Risk"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;to=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"SAN@RISK.DK"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;file mymail;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"HQLA"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"- Paper : &amp;amp;papirnavn"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"- Nominal : &amp;amp;NominalBase"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"----------------------"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; id=sysfunc(close(&amp;amp;id));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;doit&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 14:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473012#M121334</guid>
      <dc:creator>Kelroy22</dc:creator>
      <dc:date>2018-06-25T14:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473016#M121335</link>
      <description>&lt;P&gt;Retrieve the number from dictionary.tables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro doit;

proc sql noprint;
select nobs into :nobs
from dictionary.tables
where libname = 'WORK' and memname = 'CONTROL';
quit;

%if &amp;amp;nobs ne 0
%then %do;

filename mymail email
  subject="Risk Control IRK: Violation in HQLA Concentration Risk"
  to="SAN@RISK.DK"
;

data _null_;
file mymail;
put "HQLA";
put "- Paper : &amp;amp;papirnavn";
put "- Nominal : &amp;amp;NominalBase";
put "----------------------";
run;

%end;
%mend;

%doit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jun 2018 14:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473016#M121335</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-25T14:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473017#M121336</link>
      <description>&lt;P&gt;Simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro doit();&lt;BR /&gt;  filename mymail email...;&lt;BR /&gt;  data _null_;&lt;BR /&gt;    ...;&lt;BR /&gt;  run;&lt;BR /&gt;%mend doit;&lt;BR /&gt;&lt;BR /&gt;data _null_;
  set sashelp.vtable (where=(memname="CONTROL"));
  if nobs=0 then call execute('%doit;');
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 14:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473017#M121336</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-25T14:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473025#M121337</link>
      <description>&lt;P&gt;It looks like you are complicating the problem.&amp;nbsp; Macro language is not needed (except perhaps for the macro variables &amp;amp;PAPIRNAVN and &amp;amp;NOMINALBASE).&amp;nbsp; Consider this DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set control;&lt;/P&gt;
&lt;P&gt;file mymail;&lt;/P&gt;
&lt;P&gt;put .......................................;&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When there are zero observations, the SET statement halts the DATA step.&amp;nbsp; When there are observations, the rest of the DATA step proceeds once, then stops.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 14:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473025#M121337</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-25T14:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473039#M121339</link>
      <description>&lt;P&gt;Nice, I had never thought of using the set that way.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473039#M121339</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-25T15:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Send Email if Nobs - if not, dont.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473302#M121439</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;My solution ended like this. Thank you for your help. /Steffan&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;doit&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select nobs into :nobs&lt;/P&gt;&lt;P&gt;from dictionary.tables&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;where libname = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'WORK'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; and memname = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'CONTROL'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;nobs ne &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename mymail email&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;subject=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Risk Control IRK: Violation in HQLA Concentration Risk"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;to=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"san@al-bank.dk"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;attach= (&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;HQLA.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; content_type=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"application/xlsx"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;CONTENT_TYPE=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"text/html"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods listing close;&lt;/P&gt;&lt;P&gt;ods html body=mymail;&lt;/P&gt;&lt;P&gt;proc print data=work.control;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;ods html close;&lt;/P&gt;&lt;P&gt;ods listing;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;doit&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 10:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-Email-if-Nobs-if-not-dont/m-p/473302#M121439</guid>
      <dc:creator>Kelroy22</dc:creator>
      <dc:date>2018-06-26T10:57:16Z</dc:date>
    </item>
  </channel>
</rss>

