I am trying to send email via Data Integration Studio if I have a specific condition, as follows:
My condition is that if my situation variable, which comes from &_INPUT is = 'true', I send the email, if not, the program ends.
However, the following code sends the email even if the sitution is = 'false' or any other string. What am I missing?
data _null_;
set &_INPUT;
if situation ='true'
then call symput('message','this is my message');
run;
filename mymail email ("mymail@xxx.com")
subject='This is my subject';
data _null_;
file mymail;
put "&message";
run;
Hi @tazz_bh,
If &_INPUT has multiple observations then the condition if situation = 'true' would be executed in sequence for every record in &_INPUT, so if any observation in the input data set allows this condition to be true then call symput() will be executed and message will have been set up as a macro variable with the value of "this is my message", and this would not be overwritten.
If &_INPUT only has one observation, then you might have to disconnect your SAS session as the macro variable message will hold its value between runs.
You can try testing with a new session with a value of 'false' first and see if that sends the message.
If this does not address your issue then please share some of the contents of &_INPUT and state how many rows it has.
Kind regards,
Amir.
Hi @tazz_bh,
If &_INPUT has multiple observations then the condition if situation = 'true' would be executed in sequence for every record in &_INPUT, so if any observation in the input data set allows this condition to be true then call symput() will be executed and message will have been set up as a macro variable with the value of "this is my message", and this would not be overwritten.
If &_INPUT only has one observation, then you might have to disconnect your SAS session as the macro variable message will hold its value between runs.
You can try testing with a new session with a value of 'false' first and see if that sends the message.
If this does not address your issue then please share some of the contents of &_INPUT and state how many rows it has.
Kind regards,
Amir.
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.