BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jyuen204
Obsidian | Level 7

I have a piece of code that exports and emails the file to a distribution list.

 

%let subject =  Report for the week of &REPORT_DT.;
filename mymail email to=('EMAIL@EMAIL.CA')
subject=%bquote(&subject.)
attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");

REPORT_DT is just an address created for the reporting data to stamp within the subject line

 

However this generates an error when I run this.

 

If I ran it like below it works but I cannot use the REPORT_DT to timestamp the subject line


filename mymail email to=('EMAIL@EMAIL.CA')
subject='TEST Promo Report'
attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");

1 ACCEPTED SOLUTION

Accepted Solutions
Jyuen204
Obsidian | Level 7
After some more tinkering I figured out the issue.

For me to include the REPORT_DT variable I need to use double quotes in the Subject Line

filename mymail email to=('email@email.ca')
subject= "Report for the week of &REPORT_DT."
attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");

View solution in original post

3 REPLIES 3
AMSAS
SAS Super FREQ

Hi,
It would be helpful if you provided the log with the following macro options turned on

options mprint symbolgen ;

At a guess you have some kind of macro variable resolution issue, and I would start with trying this:

options mprint symbolgen ;
%put Report Date : &Report_DT
%let subject =  Report for the week of &REPORT_DT.;
%put Subject: &subject ;
filename mymail email to=('EMAIL@EMAIL.CA')
subject="Report for the week of &REPORT_DT." ;
attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");
Jyuen204
Obsidian | Level 7
29 options mprint symbolgen ;
SYMBOLGEN: Macro variable REPORT_DT resolves to Sunday, February 21, 2021
30 %let subject = BI9161 GCPromo Report for the week of &REPORT_DT.;
31 filename mymail email to=('jason.yuen@bellmts.ca')
32 subject=%bquote(&subject.)
SYMBOLGEN: Macro variable SUBJECT resolves to BI9161 GCPromo Report for the week of Sunday, February 21, 2021
NOTE: Line generated by the macro function "BQUOTE".
32 BI9161 GCPromo Report for the week of Sunday, February 21, 2021
_______
23
ERROR 23-2: Invalid option name GCPromo.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
______
23
ERROR 23-2: Invalid option name Report.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
___
23
ERROR 23-2: Invalid option name for.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
___
23
ERROR 23-2: Invalid option name the.

2 The SAS System 08:37 Wednesday, March 3, 2021

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
____
23
ERROR 23-2: Invalid option name week.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
__
23
ERROR 23-2: Invalid option name of.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
______
23
ERROR 23-2: Invalid option name Sunday.

32 ! BI9161 GCPromo Report for the week of Sunday, February 21, 2021
________
23
ERROR 23-2: Invalid option name February.

33 /*subject='BI9161 GCPromo Report'*/
SYMBOLGEN: Macro variable ENAME resolves to GCPROMO_Report_03MAR2021
34 attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");
ERROR: Error in the FILENAME statement.
Jyuen204
Obsidian | Level 7
After some more tinkering I figured out the issue.

For me to include the REPORT_DT variable I need to use double quotes in the Subject Line

filename mymail email to=('email@email.ca')
subject= "Report for the week of &REPORT_DT."
attach=("/data/bi/data/inbox/MTS/&ENAME..csv" content_type="application/xlsx");

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 672 views
  • 0 likes
  • 2 in conversation