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

Hi,

 

I'm trying to send an email with attachment via SAS, but it seems not to recognize the local route of the file. Everytime I try to send it, I get the error: 

 

ERROR: Error opening attachment file C:\SASDATA\DATA.csv.
ERROR: Physical file does not exist, /sas/sasconfig/Lev1/SASApp/C:\SASDATA\DATA.csv.

 

The code is:

 

FILENAME MailBox EMAIL ATTACH='C:\SASDATA\DATA.csv'

to= ('ch@hotmail.com')
type='text/html'
subject= 'TEST'
from='DE@hotmail.com';

data _null_;
file MailBox;
put 'FILE ATTACHED';
run;

 

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Enterprise Guide is just a frontend for a so-called workspace server, which is the actual SAS process that does all the work. In your case, this workspace server runs on a remote UNIX server. To include a file as an attachment in mail directly out of SAS code, the file needs to reside in the UNIX server, or on a shared network resource visible from the server.

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

Enterprise Guide is just a frontend for a so-called workspace server, which is the actual SAS process that does all the work. In your case, this workspace server runs on a remote UNIX server. To include a file as an attachment in mail directly out of SAS code, the file needs to reside in the UNIX server, or on a shared network resource visible from the server.

new_sas_user_4
Obsidian | Level 7

I am getting a similar error....

I kindoff understand your response but how can rectify the problem of "Physical file does not exist"..

 

My code is :

%let report_file = %sysfunc(pathname(work));
ods pdf file="&report_file/Name_of_file.pdf" pdftoc=1 startpage=yes bookmarklist=hide;

 

.......proc report portion.............

ods pdf close;

 

filename mailbox email attach='&report_file/Name_of_file.pdf'
to ='my_email@sas.com'
from='my_email@sas.com'
replyto='my_email@sas.com'
subject='mail file'
;run;

 

data _null_;
file mailbox;
put "Hi,";
Put "Attached is the Report";
put ;
put "Regards";
run;

 

I get the error:

ERROR: Error opening attachment file:&report_file/Name_of_file.pdf.

ERROR: Physcial file does not exist, /sasnoapps/prodnoconfig/Lev1/Server1/&report_file/Name_of_File.pdf.

 

Please help!

Tom
Super User Tom
Super User

The macro processor does not process text inside of single quote characters. Use the double quote character instead like you did earlier in the program.

attach="&report_file/Name_of_file.pdf"

 

new_sas_user_4
Obsidian | Level 7

This might have been a simple thing for you ...but you saved me so much more reading..

I am doing this for the first time and had been reading stuff from ..SMTP setup, a few other pdfs... etc to resolve this...

 

Thanks a tonnnnnnnnnnn 🙂 

 

Any reading material on proc report? 

Any material on formatting a ods pdf ?

rodrichiez
Quartz | Level 8

Hi @new_sas_user_4 ,

 

Attached I let you an useful reading about PROC REPORT. 

 

Regards.

new_sas_user_4
Obsidian | Level 7

Thank you 🙂 

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
  • 6 replies
  • 3703 views
  • 1 like
  • 4 in conversation