BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phil20
Obsidian | Level 7

Hi there

I need help on building a SAS job to send an email from mainframe. The email has 2-3 lines of content and an attachment. The attachment is a PDS file to attach as a text file. I was able to send mail without attachment. but the attachment part not working for me.

 

//xxxxxxx JOB MSGCLASS=J,MSGLEVEL=1,NOTIFY=&SYSUID
//SAS9 EXEC SAS
FILENAME MAILBOX EMAIL;
DATA _NULL_;
FILE MAILBOX TO=('xxxxxxx@xxxxx.com') 

SUBJECT='MONTHLY FILE';
PUT "Hello xxxx,";
PUT " ";
PUT "This is to inform you that xxxxxxxxxxxxxxxxxx.";
PUT "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.";
PUT " ";
PUT "Best regards,";
PUT "xxxxxxxxxxxxxxxxxxxx";
RUN;
//*

 

1 ACCEPTED SOLUTION

Accepted Solutions
Phil20
Obsidian | Level 7

Thank you so much Lasen

It worked exactly as I expected. you made my day.

 

View solution in original post

4 REPLIES 4
s_lassen
Meteorite | Level 14

I think the normal style is to put the email options in the FILENAME statement, rather than in the FILE statement, e.g.:

//xxxxxxx JOB MSGCLASS=J,MSGLEVEL=1,NOTIFY=&SYSUID
//SAS9 EXEC SAS
FILENAME MAILBOX EMAIL TO=('xxxxxxx@xxxxx.com') SUBJECT='MONTHLY FILE' attach="user.misc.pds(member)";
DATA _NULL_;
FILE MAILBOX;
PUT "Hello xxxx,";
PUT " ";
PUT "This is to inform you that xxxxxxxxxxxxxxxxxx.";
PUT "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.";
PUT " ";
PUT "Best regards,";
PUT "xxxxxxxxxxxxxxxxxxxx";
RUN;
//*
Phil20
Obsidian | Level 7

Thank you so much Lasen

It worked exactly as I expected. you made my day.

 

s_lassen
Meteorite | Level 14
Then I think you should mark my suggestion as a solution 🙂
Phil20
Obsidian | Level 7

how do i do that?. I am new to this blog );

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 756 views
  • 0 likes
  • 2 in conversation