Emailing attachments

New Contributor
Posts: 3

Emailing attachments

I have this block of code which creates a bunch of files and formats them.  I would like to email these files one at a time, how would i do that?

data _null_;


  filename=cats('C:\Documents and Settings\user\Desktop, \block',filenum,'.txt');

  file v_id filevar=filename ;

  put '(' @ ;

  do _n_=1 to &max while (not eof);

     set v_id end=eof;

     if _N_>1 then put ',' @;

     put "'" vendorid +(-1) "'" ;


  put ')';


  if eof then stop;


Super User
Super User
Posts: 8,070

Re: Emailing attachments

Posted in reply to supersoup

Read up on the EMAIL engine of the FILE statement.

You might want to add a statement to your previous step to save the final FILENUM variable value into a macro variable that might make it easier to generate the right number of attachments to the emails.

To create the macro variable FILENUM add this line above the current IF EOF line.

if eof then call symput('filenum',filenum);

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation