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!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.