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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.