BookmarkSubscribeRSS Feed
Eugenio211
Quartz | Level 8

Hello - hope everyone is ok.

 

I am running the code below and kept getting the 'ERROR' email.  I've checked the previous data steps and found no errors.  Does anybody have an idea what I am missing? Thanks a lot!

 


%if &syscc=0 %then %do;
proc export data=ReportData
dbms=xlsx
replace
outfile='\\drive\Daily_Reporting\Report Name';
sheet='Data';
run;

filename mymail email 'jsmith@email.com'
from='jsmith@email.com'
subject='Report Name'
attach=("\\drive\Daily_Reporting\Report Name'" content_type="appication/xlsx");

data _null_;
file mymail
to=(
'lsmith@email.com'
)
cc=('jsmith@email.com');
run;
%end;
%else %do;
filename mymail email 'jsmith@email.com'
from='jsmith@email.com'
subject='Report Name';

data _null_;
file mymail
to=('jsmith@email.com');
put "ERROR :(";
run;
%end;

1 REPLY 1
ballardw
Super User

What exactly is the value of &syscc ? If it is not 0 then the code shown behaves as intended.

 

From the documentation:

Contains the current condition code that SAS returns to your operating environment (the operating environment condition code).

So likely you are checking the wrong variable as this is intended to notify something related to the overall status of a SAS job when completed, which is why you can have code that assigns values.

 

Perhaps you are looking for the SYSERR automatic variable? You want to check the documentation for that but not all procedures will set the variable.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 579 views
  • 0 likes
  • 2 in conversation