BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SAS_inquisitive
Lapis Lazuli | Level 10

This is from SAS doc.

 

The STOP statement stops processing of a DATA Step and passes control to the next statement following the end of the DATA step.

 

What does passes control mean here?

 

And under which conditions stop or abort statements are used?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

"Passes control" means that  SAS processes the next statement after the DATA step. This might be another DATA step, a procedure call, or a global variables. Often it is the statement after the RUN statement that ends the DATA step.

 

The ABORT statement is used when there is an unrecoverable error. For example, if a data set does not contain any valid observations for an analysis (maybe all are missing), you might want to exit the computation. The ABORT statement supports options that tell SAS what to do next (Continue on? Terminate SAS?).

 

The STOP statement is used to prevent an infinite loop when you are performing random access of observations. It does not imply that there was an error, it just means "stop the DATA step and continue processing the SAS program." The STOP statement must be used to end the DATA step processing when you use the POINT= option, because SAS never encounters the end-of-file indicator during random access. For an exaple, see the article "Sample with Replacement in SAS."

 

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

"Passes control" means it executes the next statement after the data step.

 

ABORT can be used to stop a the execution of a datastep, or stop the execution of an entire program, or to end the entire SAS session.

--
Paige Miller
RW9
Diamond | Level 26 RW9
Diamond | Level 26

TBH in 14 odd years I have never found a reason to use either and I suspect that the use of such suggest the program isn't written in a robust manner.  My log check pulls these terms out as errors.

ballardw
Super User

@RW9 wrote:

TBH in 14 odd years I have never found a reason to use either and I suspect that the use of such suggest the program isn't written in a robust manner.  My log check pulls these terms out as errors.


I suspect that most use of the abort is with mainframe batch jobs. I used to have a job that required running certain programs in batch that required human intervention, loading tapes to read and setting pens in a plotter. Because we were charged for computer time if the intervention wasn't performed in a timely manner or if the mounted tape didn't read correctly for any of a number of reasons we aborted the jobs with suitable messages written to the log. Admittedly that was nearly 30 years ago.

Rick_SAS
SAS Super FREQ

"Passes control" means that  SAS processes the next statement after the DATA step. This might be another DATA step, a procedure call, or a global variables. Often it is the statement after the RUN statement that ends the DATA step.

 

The ABORT statement is used when there is an unrecoverable error. For example, if a data set does not contain any valid observations for an analysis (maybe all are missing), you might want to exit the computation. The ABORT statement supports options that tell SAS what to do next (Continue on? Terminate SAS?).

 

The STOP statement is used to prevent an infinite loop when you are performing random access of observations. It does not imply that there was an error, it just means "stop the DATA step and continue processing the SAS program." The STOP statement must be used to end the DATA step processing when you use the POINT= option, because SAS never encounters the end-of-file indicator during random access. For an exaple, see the article "Sample with Replacement in SAS."

 

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!

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