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 "[email protected]";
data _null_;
file mymail
From = ("[email protected]")
To = ([email protected])

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='[email protected]'
   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='[email protected]'
   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.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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