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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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