Emailing attachments

Reply
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_;

  filenum+1;

  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) "'" ;

  end;

  put ')';

      

  if eof then stop;

run;

Super User
Super User
Posts: 6,495

Re: Emailing attachments

Read up on the EMAIL engine of the FILE statement.

http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n0ig2krarrz6vtn...

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
  • 171 views
  • 0 likes
  • 2 in conversation