BookmarkSubscribeRSS Feed
Pavan4
Calcite | Level 5

The following code generate  a report .

proc sql;

SELECT PROMO_NBR, PROMO_DESC, Count(PID) as Total FROM eza_lead_report GROUP BY PROMO_NBR, PROMO_DESC;

quit;

 

The report should shared by email.

 

Error message :

ERROR: Email: The connection was refused.

 

Email code for using :

...............................................................................................................................................................

FILENAME outmail EMAIL

SUBJECT="Results as of %sysfunc(date(),yymmdd10.)"

FROM= "ex10testq@mtbdev.com"

TO= "pmuttineni_contractor@mtb.com"

ATTACH= "/madata/MAExports/LeadFiles/data.pdf";

FILENAME output EMAIL

SUBJECT= "EZA Leads Report Summary"

FROM= "ex10testq@mtbdev.com"

TO= "pmuttineni_contractor@mtb.com"

CT= "text/html" ;

ODS HTML BODY=output STYLE=sasweb;

TITLE JUSTIFY=left

"Total Sales by Country and Product type as of %sysfunc(date(),yymmdd10.)";

 

/*PROC REPORT DATA=eza_lead_report NOWD

STYLE(REPORT)=[PREHTML="<hr>"] ;

COLUMNS PROMO_NBR PROMO_DESC,Count;

DEFINE PROMO_NBR /GROUP;

DEFINE PROMO_DESC/GROUP;

DEFINE PID/SUM ;

RUN;*/

title1 "Report genarated on %sysfunc(date(),worddate18.)";

 

 

proc sql ;

create table eza_lead_report as select * from Standard;

quit;

proc sql;

SELECT PROMO_NBR, PROMO_DESC, Count(PID) as Total FROM eza_lead_report GROUP BY PROMO_NBR, PROMO_DESC;

quit;

ODS HTML CLOSE;

DATA _NULL_;

FILE outmail;

PUT "Here are the results for your last query";

RUN;

 

 

1 REPLY 1
Kurt_Bremser
Super User

You need to make sure that your SMTP access is correctly configured into SAS.

See here: http://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=lesysoptsref&docsetTarget=...

(Category Communications: email)

And your code would send two emails, as the ods html close would close the first email, and the data step another one.

Your final piece of code should be

data _null_;
file print;
put "Here are the results for your last query";
run;

ods html close;

You could also use ods text to insert text into the stream.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1167 views
  • 0 likes
  • 2 in conversation