BookmarkSubscribeRSS Feed
Sharath_naik
Obsidian | Level 7

proc sql noprint;
select count(file)into :cnt from new_file;
select email_id into :email_id from ack;
select cat into :cat from want;
quit;

%put &cat.;


%macro Mail_S;
%if &cnt %gt 0 %then %do;
OPTIONS EMAILSYS=SMTP EMAILHOST=intramail.cis.cat.com EMAILID="abc@com";
FILENAME BLAT EMAIL
FROM = ( "Abc@com" )
TO = ( "Abc@com" )
cc = ("Abc@com")
SUBJECT = ( "New Order Acknowledgement -(&sysdate9.)")
ATTACH = ( &cat. ct='application/octet-stream' )
TYPE = "TEXT/HTML"

;
DATA _NULL_;
FILE BLAT;
PUT '<HTML><BODY>';
put "Hi Team,<BR>";
put "&emsp; recieved on &sysdate9..<BR><BR>";
put 'If you have any questions,<BR><BR>';
put "Thank You, <BR><BR>";
put "Team<BR><BR>";
put '</BODY></HTML>';
run;
%end;
%mend Mail_s;

%mail_s;

 

 

When ever i send using above code, only one pdf file is able to open , remaining file will not be opened , please help me to figure out thisissue

2 REPLIES 2
RichardDeVen
Barite | Level 11

Show the data you have for tables NEW_FILE, ACK, and WANT

Kurt_Bremser
Super User

Create a correct list of files to be attached:

select quote(strip(cat)) into :cat separated by " " from want;

and you'll get a list of quoted filenames as described in the documentation of FILENAME EMAIL.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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