BookmarkSubscribeRSS Feed
Mohkad
Calcite | Level 5

Hello,

 

I try to send report by Email using SAS EG, But when I try the same code in SAS Base, there is an error happen as warrning in the begin include this messege: "WARNING: No output destinations active." .

Then,  the report only shows 2 columns of 6, after that the macro report window doesn't close by itself so I close it by myself so I can go back to the editor to check program and run it again.

Then, When I close the window, there is an error appear in the log which is: "ERROR: Email: The connection was refused.".

 

Here is the code:

%macro send_mail(); 
options emailsys=smtp;
options emailauthprotocol=none;
*options emailhost="xx.xx.xx";
*options emailport=25;
*options emailpw = "xxxxxx";

 
filename temp email
to = ( "my@email.com" )
subject="Test"
type="text/html"
from ="xxxxx@xxxx.com" ;

 
ODS html body=temp style =  RTF ;  /*HTMLBlue JOURNAL ANALYSIS  PEARL LISTING SAPPHIRE */
ods html text = "This is an automatic message please do not reply,";
ods html text = "there is an issue!" ;

ods html text = "";
 
PROC REPORT DATA=WORK.x
 
style (report) = {background = white
font_face = "Verdana" font_size = 7pt just=left }
style (column) = {background = white CELLHEIGHT = 2.5%
font_face = "Verdana" font_size = 7pt just=left}
style (header) = {foreground = cx5e2750 font_face="Verdana"
font_size = 8pt just=left
background = white} ;

DEFINE ISSUE_ID / 'Issue ID';
define REFERENCE_NO / 'Reference NO';
define ISSUE_SHORT_DESC / 'Issue Short Description';
define user_id / 'User ID';
define DISPLAY_NM / 'Display Name';
define Closed_Date /'Closed Date';

run;
ods html text = "";
ods html text = "Regards";
ods html text = "";
ods html text = "Risk Mgmt. Application support team ";
ods _all_ close;
%mend send_mail;

%macro check();
proc sql;
select count(*) 
into: n
from work.x;
quit;

%if &n = 0 %then
    %put "N is NOT" ;
%else 
	%send_mail;
  
%mend check;

/* call the macro */
%check;

 

and here is the log since the first warnning:

 

2643 %mend check;
2644 %check;
WARNING: No output destinations active.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds


NOTE: Writing HTML Body file: TEMP

NOTE: There were 39 observations read from the data set WORK.RB_OBS_NOTI.
NOTE: PROCEDURE REPORT used (Total process time):
real time 5:30.44
cpu time 0.50 seconds


ERROR: Email: The connection was refused.

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

The proc sql at the start of macro check has nowhere to write the result of its select statement.

Open a destination or write to a table.

 

The mail error is a different matter and I expect that your EG server has the email configured when our desktop SAS doesn't.

Ask your SAS admin for the email parameters.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 914 views
  • 0 likes
  • 2 in conversation