BookmarkSubscribeRSS Feed
Jose_Alberis
Calcite | Level 5

Boa tarde amigos,

 

 

Estou executando um programa proc sql no sas, e preciso fazer verificações em que caso encontre algum campo que se declare falso no case, ele aborte o processo e não crie a tabela e se possível não rode os demais programas.Tentei usar a função Abort mas não estou conseguindo acertar a sintaxe dela. Alguém consegue me ajudar com esse tema ?

1 REPLY 1
s_lassen
Meteorite | Level 14

You may want to post in English, not that many people on this forum understand Portuguese. If I understand your question correctly, you are doing SQL processing and you want to stop program execution if something goes wrong, as determined by you verification process.

 

The ABORT statement is not SQL, but you can use it from a data step or as a macro (as %ABORT).

 

So, depending on what you want to do, you could put something like this in your code:

Proc sql;
/* first part of your SQL program here */
quit;

data _null_;
  if &sqlobs=0 then /*if no observations affected by last SQL statement */
    abort cancel;
run;

Proc sql;
  /* more SQL statements here */
quit;

I used "abort cancel" because that stops execution of the program without terminating your SAS session, if your are in a windowed environment. In a batch environment it terminates the SAS session.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 517 views
  • 0 likes
  • 2 in conversation