.pptx) using the ODS PowerPoint destination and properly closed it with:FILEEXIST=1).FCOPY successfully copies the PPTX to a local WORK directory (RC=0)..pptx files rather than a problem with the PowerPoint file itself..pptx attachments being truncated or corrupted when sent through the SAS Email engine? If so, were there any recommended workarounds or configuration changes?You might try something like zipping the pptx file before emailing it, if you suspect it's getting corrupted by SAS or your mail server. Maybe that's a silly idea, since pptx is literally a zip file.
You could try changing the extension on the .pptx to something neutral like .txt in case your email system has blocker on sending .pptx files.
If you have IT support, you might want to check with them to see if they can see if the mail server logs say anything interesting.
I guess it's possible SAS somehow munged the file during upload. If you do a simple .pptx with just one slide from PROC PRINT, does the email work?
The usual way to add an email attachment that is for a specific application is to use the CONTENT_TYPE option. Try something like this:
filename mymail email "[email protected]"
subject="PPT Test"
attach=("MyPPT.pptx" content_type="application/pptx");
data _null_;
file mymail;
put 'Hi Me,';
put 'This is a test.';
run;
If you copy a BINARY file as TEXT it can become corrupted.
Please share the code you used for FCOPY , in particular how you defined the two FILEREFs used. Make sure your are not using RECFM=V. Using RECFM=F is best, RECFM=N might work also.
RECFM= option was specified.RECFM= option was specified.
This worked fine for me. I created a test PPTX in Powerpoint, saved it to a SAS server folder, ran the below program. I just double-clicked on the email attachment and the Powerpoint opened as I expected:
filename mymail email "[email protected]"
subject="PPTX Test"
attach=("TestPPTX.pptx" content_type="application/pptx"
);
data _null_;
file mymail;
put 'Hi Me,';
put 'This is a test.';
run;
This is the test email:
@bijayadhikar wrote:
Sorry for typo. PPTX was not copied as text.
Why do you think that?
Try being specific in how you want SAS to read and write the files when copying.
filename src "&pptpath" recfm=f lrecl=512;
filename dst "&pptlocal" recfm=f lrecl=512;
Also make sure to tell the email process what type of file it is attaching, this will help the recipient know what application to use to open the file. It will also help with email filters.
filename mymail email
to = "my.email@com"
subject = "Monthly Performance Deck"
attach = ("&pptlocal" content_type="application/pptx")
;
1) Try this code
filename src "&pptpath"; filename dst "&pptlocal"; -------> filename src "&pptpath" recfm=n; filename dst "&pptlocal" recfm=n;
https://blogs.sas.com/content/sasdummy/2013/09/17/copy-file-macro/
2) Try RENAME() function:
data _null_;
rc=rename("c:\old\x.pptx","c:\new\x.pptx",'file');
put rc= ;
run;
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.
Ready to level-up your skills? Choose your own adventure.