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 ?
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.
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 25. Read more here about why you should contribute and what is in it for you!
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.