%let email = ('bbbb@abc.com' 'dddd@abc.com' 'fff@abc.com');
filename mailit email;
options nosyntaxcheck;
%macro completeit; %if &syscc > 999 %then %do; data _null_; file mailit to=&email subject="&syscc.sas failed"; put "This is an automated message that "&syscc.sas failed" failed with an error code &syscc.."; put; run; %end; %else %do; data _null_; file mailit to=&email subject="job not completed"; put ; put "&outdirectory."; put "=================="; run; %end;
Program:
An email is created and sent over if the program succeeds. I don't have a log created for this code. This code is not resolved or opened in the log window.
Any help is appreciated!
Thanks,
Blue blue
A SAS macro must start with a %MACRO statement and end in a %MEND statement. I don't see a %MEND statement in your code. However to call the macro you need to add the statement %COMPLETEIT; as well otherwise it will never get executed.
Try this:
%macro completeit;
%if &syscc > 999 %then %do;
data _null_;
file mailit
to=&email
subject="&syscc.sas failed";
put "This is an automated message that "&syscc.sas failed" failed with an error code &syscc..";
put;
run;
%end;
%else %do;
data _null_;
file mailit
to=&email
subject="job not completed";
put ;
put "&outdirectory.";
put "==================";
run;
%end;
%mend;
%completeit;
A SAS macro must start with a %MACRO statement and end in a %MEND statement. I don't see a %MEND statement in your code. However to call the macro you need to add the statement %COMPLETEIT; as well otherwise it will never get executed.
Try this:
%macro completeit;
%if &syscc > 999 %then %do;
data _null_;
file mailit
to=&email
subject="&syscc.sas failed";
put "This is an automated message that "&syscc.sas failed" failed with an error code &syscc..";
put;
run;
%end;
%else %do;
data _null_;
file mailit
to=&email
subject="job not completed";
put ;
put "&outdirectory.";
put "==================";
run;
%end;
%mend;
%completeit;
Hello SASKIWI,
Wow, it is resolved! Thank you so very much. I needed to deliver the results of the program to leaders.
Thanks,
Bita
Hello team,
After a month, I came to run this code that mentioned on the start of this forum, it fails with error code 3000. While the program run correct, but the email message is created is a fail.
SYMBOLGEN: Macro variable SYSCC resolves to 3000
I can't send the rest of the log, because it is confidential.
Regards,
blue
hello team,
I ran into same issue after a month.
I get &syscc to 3000.
I run the program line by line and no error in the log but as soon as I go to the part which I marked as answer, it gives me error code 3000.
regards,
a blue
If the code was working correctly and the code was not changed then something else has changed. Possibly email addresses??? or stuff sent to the email system.
I might ask about changes to your system done by IT for any of the involved programs such as email.
If the code was changed, then you get start all over with the debug cycle.
Anything except zero is unnacceptable for SYSCC at the end of a job.
Any non-zero value means (at least) one of:
You need to work through your whole log from top to bottom to fix any occurence of the above. If in doubt, add
%put &=syscc.;
frequently in your code to detect the location where something goes wrong (if it's not an obvious ERROR or WARNING).
Thanks,
I had a backup of the program so I used that one and I never realized what is the difference one works and one doesn’t work.
respectfully,
blue thunder
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.