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

I am attempting to use the ATTACH statement in an email with multiple attachments and the following error is returned:

data _null_;
rd = strip(put(&run_date,mmddyyd10.));
call symputx('rd',rd);
run;

filename mymail email "xxx.sas@xxx.com";
data _null_;
file mymail
From = ("developers.sas@xxx.com")
To = (myself@xxx.com)

subject=(" Reports &rd");
attach=("\\xxx\Reports TOC &rd..xlsx" "\\xxx\REC.xlsx" );

run;

 

 

The log returns error 22 (syntax error saying it was expecting another operator and it fails. I also need to send several pdf files in the same email.

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

could you please try the below syntax of the code to send the attachments, this worked for me

 

filename outbox email
   to='xxxx.xxxx@xxxxx.com'
   type='text/html'
   subject='subject line'
   attach=('~path1/creat_bssa.csv' '~path2/creat_bssa.csv');

data _null_;
file outbox;
put 'Hi';
run;

 

 

 

 

 

 

Thanks,
Jag

View solution in original post

3 REPLIES 3
Jagadishkatam
Amethyst | Level 16

could you please try the below syntax of the code to send the attachments, this worked for me

 

filename outbox email
   to='xxxx.xxxx@xxxxx.com'
   type='text/html'
   subject='subject line'
   attach=('~path1/creat_bssa.csv' '~path2/creat_bssa.csv');

data _null_;
file outbox;
put 'Hi';
run;

 

 

 

 

 

 

Thanks,
Jag
Doug____
Pyrite | Level 9

Now the code runs but no email appears.

SASKiwi
PROC Star

Are you running this locally on your PC or on a remote SAS server? If it is on your PC then it is likely you need additional settings to get email working. If you are running this on a remote SAS server then talk to your SAS administrator about the correct settings for emailing from SAS.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 476 views
  • 0 likes
  • 3 in conversation