I use the EMAIL device to send email through SAS from a Linux system. This works just fine in most cases, but when I attach an .xlsx file the file somehow gets corrupted. When I receive the email, everything looks good, but Excel can’t open the attachment. It gives an error message "We found a problem with some content in..." and then "Excel cannot open the file...". I see that the documentation for the EMAIL device has an option CONTENT_TYPE='content_type', but no indication what the possible values are. Is there a particular content type that should be specified? Or is there something else that needs to be done to allow .xlsx files to be attached? I’ve seen a post here from 2013 with the same problem, but no resolution. Below is code used:
filename em
email ("&emailaddr.")
to = ("&emailaddr.")
subject = "Test"
attach = ("/amex2/ramp/misc/gsc_glob/tashelly/ods/GCG_Unique_CM_201911.xlsx")
emailid = "&emailaddr."
;
data _null_;
file em;
put "Test";
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.