BookmarkSubscribeRSS Feed
b1958
Fluorite | Level 6

 

Hi

 

Is it possible to terminate a DS2 program with error? If so how?

 

I noticed that the Abort statement is not available in DS2.

 

Thanks.

 

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

I guess an ugly kludge could be to add something like this:

 if COND then do; DIV=0 ;DIV=1/DIV; end;  

This results in a general error and stops further processing.

s_lassen
Meteorite | Level 14

To put an error in the log, use the log metod, e.g.:

proc ds2 ;
data _NULL_;
   dcl package logger root();
   method init();
      root.log(n'error', 'you got yhis all wrong!');
   end;
enddata;
run;
quit;

To stop execution, use STOP or whatever.

b1958
Fluorite | Level 6

Hi

I ran your exact code from EG. Is it possible to get the Message out in  the regular job log?

 

 

NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
26         proc ds2 ;
27         data _NULL_;
28            dcl package logger root();
29            method init();
30               root.log(n'error', 'you got yhis all wrong!');
31            end;
32         enddata;
33         run;
NOTE: Execution succeeded. No rows affected.
34         quit;

NOTE: PROCEDURE DS2 used (Total process time):
      real time           1.73 seconds
      cpu time            0.09 seconds
      
b1958
Fluorite | Level 6
I, ll read more about the logger package and I 'll post here if I find out something.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4 replies
  • 571 views
  • 0 likes
  • 3 in conversation