Hello Experts,
I'm coding in SAS EG, I would like to stop the execution of my program if I have 0 rows in my data. Do you know some option to do that please ?
I mean thant in my EG projet I have 3 programs : firstly I run the pgm_1, after the pgm_2 and the pgm_3.
I would like to put the code in pgm_1, and stop the pgm_2 and pgm_3 if _n_=0 (I run the program by order list). I don't know if it's possible in EG.
My code is:
proc sql noprint;
select count(*) into :nb from PRRT;
quit;
%if &nb=0 %then
%do;
STOP ?
%end;
Thank you very much !
Hi @SASdevAnneMarie ,
Have you tried looking into the abort statement? The documentation can be found here.
Kind regards,
Amir.
Hi MarieT,
You can do it this way, for example:
%if &nb=0 %then
%do;
data _null_;
abort return;
run;
%end;
See ABORT Statement.
Hope this helps.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.