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.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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