I'm running into an issue where one of my recipients has a "-" in their email address when I'm setting it up in %LET EMAIL_TOLIST=
"ERROR 23-2: Invalid option name" is the error message that pops up.
Is there a way to work around this?
Try using to=(&EMAIL_TOLIST) as in
filename mymail email to=(&EMAIL_TOLIST) type='text/html' subject='Test';
You can still place your code replacing partial email address and real server names with valid characters e.g. XXXXX, not ***** which as not valid for server and email names.
Please post the whole log from the %let up to the ERROR. Use the </> button for posting the log.
<
49 %LET EMAIL_TOLIST= 'abc-abc@*****.com';
50
2 The SAS System 13:37 Wednesday, April 1, 2020
51
52
53 options emailsys=smtp emailhost=intmail.*****.net emailport=25;
54 filename mymail email &EMAIL_TOLIST
55
56 type='text/html'
NOTE: Line generated by the macro variable "EMAIL_TOLIST".
56 'abc-abc@*****.com'
_______________________________
23
ERROR 23-2: Invalid option name 'abc-abc@*****.com'.
57 subject='Test';
ERROR: Error in the FILENAME statement.
/>
I don't think "-" is a problem. What are your asterisks ***** in the emailhost and why it's not quoted?
Can you please place your code to show what exactly you run?
The code works fine if I use a different email address though.
I'm just censoring out the email host name in case it's sensitive.
Try using to=(&EMAIL_TOLIST) as in
filename mymail email to=(&EMAIL_TOLIST) type='text/html' subject='Test';
You can still place your code replacing partial email address and real server names with valid characters e.g. XXXXX, not ***** which as not valid for server and email names.
Thank you for the help!
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.