BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

Why are you using macro code for this?  The SQL step can generate the list of attachments.

LIBNAME project "U:\Data Programs";

PROC SQL noprint;

  SELECT DISTINCT quote(catx('\',pathname('project'),cats(FILENAME1,'.PDF')))

    INTO :FILELIST SEPARATED BY ' '

    FROM WORK.FILE_LIST

  ;

QUIT;

FILENAME mail EMAIL

  TO = "Lisa1245@yahoo.com"

  FROM = "argo34@yahoo.com"

  ATTACH=(&filelist)

;

data _null_;

  file mail;

  PUT "Hi Lisa,";

  PUT " ";

  PUT "This is test";

  PUT " ";

  PUT "Thanks,"

RUN;

twildone
Pyrite | Level 9

Hi Tom....I made the changes as you suggested and I still get the following error message ( when I look at the SYMBOLGEN in the log, it indicates that the Macro variable Filelist resolves to exactly the name of the files that should be attached):

NOTE: The file MAIL is:

      E-Mail Access Device

ERROR: Unable to access E-mail attachments.

NOTE: The SAS System stopped processing this step because of errors.

     

Tom
Super User Tom
Super User

Are you sure the files exist? 


data _null_;

  set file_list;

  fname = catx('\',pathname('project',cats(filename1,'.PDF'));

  exist = fileexist(fname);

  put exist= fname= ;

run;


See if you can open the files from a data step. 

FILENAME files (&filelist);

data _null_;

  infile files recfm=n;

  input x $char5. ;

  put x= $hex10.;

  stop;

run;

twildone
Pyrite | Level 9

Hi Tom.....Yes the files exist. I even open them to make sure they both contained content. I ran the code you provided and it seems to indicate that the files exiist...Here is the output:

FILENAME1

Sales Report

Return Merchandise Report

Kurt_Bremser
Super User

The (not so) funny thing is that the SAS knowledge base has no fitting entry for

ERROR: Unable to access E-mail attachments.

google also does not find a real SAS documentation for it.

So this very much looks like an undocumented message.

I'd throw it to SAS TS.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 6766 views
  • 0 likes
  • 6 in conversation