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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.