BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi everyone, we use email to send reports to people and because of the size of some of them we are looking to instead send out a shorcut to the file. The below code is a snippet of what we use to send a file out which I've changed to attach a windows shortcut, but, while it attaches the file the shortcut doesn't work. When I did a properties on the attachment it is only 551 bytes, if I manually attach the same shortcut to an email the attachment is 1153 bytes. Has anyone come across this problem before, and more importantly, know what is wrong? 🙂

Thanks.

filename SendMail email to=(&macvar.)
subject="SAS Processing : Duplicate Party Records Report"
attach=("\\svrbu3file\shared\public\Inf_Mgt\Projects\Data Quality\Reporting\Exception Reports\Shortcut to Issue 158 - Duplicate party records.xls.lnk")
type='Text/Html' ;

ods html
style=SasWeb
body=SendMail
rs=none;
4 REPLIES 4
advoss
Quartz | Level 8
Try adding content_type to the attach= options. I believe that the shortcut (.lnk) is actually a binary file. I've had success in the past referring to binary files as image files. So try something like:
filename SendMail email to=(&macvar.)
subject="SAS Processing : Duplicate Party Records Report"
attach=("\\svrbu3file\shared\public\Inf_Mgt\Projects\Data Quality\Reporting\Exception Reports\Shortcut to Issue 158 - Duplicate party records.xls.lnk" content_type="IMAGE/GIF")
type='Text/Html' ;
Bill
Quartz | Level 8
Rather than attach a file or shortcut, I build a hot link into the email message. Code below.

filename mail email ' '
from=("me@company.ca")
to=("you@company.ca")
subject="Sales Report for %sysfunc(datetime(),datetime13.)";

data _null_;

file mail;

put "auto email report, brought to you by SAS®";
put " ";
put "Double click on the link below to view or print";
put " ";
put "\\Drive\Directory\SubDirectory\SalesReport.pdf";
put " ";
run; Message was edited by: Bill
deleted_user
Not applicable
Advoss : that fixed the problem. Thanks.

Bill : Originally I was going to use hotlinks but it didn't like spaces in the filename or path, it would end the link at the character before the space. I was using :

a href="file:\\svrbu3file\shared\public\Inf_Mgt\Projects\Data Quality\Reporting\Exception Reports\Issue 158 - Duplicate party records.xls">S:\public\Inf_Mgt\Projects\Data Quality\Reporting\Exception Reports\Issue 158 - Duplicate party records.xls';

Output;
Bill
Quartz | Level 8
If there are blanks in the string, you can fill them with %20, e.g. Issue 158 becomes Issue%20158.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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
  • 4 replies
  • 1794 views
  • 0 likes
  • 3 in conversation