BookmarkSubscribeRSS Feed
RicoQQ
Calcite | Level 5
Hi,

I am trying to make a SAS JOB fail. I need a way to make a job fail if the last table has no columns. How can I do this? I made a user transform with one input and no output, I can count the rows, but can't find a way to make an error of it.That is I can make an error but it happens even when there are multiple rows in the table. I used ABORT way to stop it, but this does not generate an error. But the user tranform wont let me use my macro for sending mail in this case. So then I need an error as this generates an error mail.

Hope someone knows.

-Daniel
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
SAS version? OS where SAS JOB is running? This information makes a difference and is important with each SAS forum post.

And please...share your code that is not working for you to get useful feedback.

Scott Barry
SBBWorks, Inc.
RicoQQ
Calcite | Level 5
This is for DI Studio 3.4 (metaserver 9.1.3.4)

I do not have much code as I do not get it to work, but here is what I start with;

%LET dsid=%SYSFUNC(OPEN(&syslast.));
%LET n=%SYSFUNC(ATTRN(&dsid,NOBS));
%LET rc=%SYSFUNC(CLOSE(&dsid));

This gives me number of records in last table, so if &n. < 1 then I want the job to go to error. This is all suposed to happend in a user transform.

Any idea?

-Daniel
FredrikE
Rhodochrosite | Level 12
abort abend???
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
To start, you are working with the SAS macro language. So you will need to consider coding a SAS macro with %IF %THEN %DO %END (possibly) and use the %ABORT statement. Or as was mentioned, conditionally execute a SAS DATA step to generate a more meaningful output message to the SAS log and then execute an ABORT ABEND statement.

Also, in addition to the recommended DOC reading below, you may find additional info in the SAS companion guide for your Operating System, where ABORT is further discussed for your OS.

Scott Barry
SBBWorks, Inc.

SAS Macro Language - %ABORT Statement
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002475061.htm

SAS Language Dictionary - ABORT statement
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000230210.htm

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 951 views
  • 0 likes
  • 3 in conversation