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 );

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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
  • 4 replies
  • 2849 views
  • 0 likes
  • 2 in conversation