DATA Step, Macro, Functions and more

How to stop the saving my code

Reply
Contributor
Posts: 52

How to stop the saving my code

Hi all,

How to stop the saving my code,If my code having any error or any warning or any unwanted Note in the log Window.

Please help me out, Since i don't have any idea how to achieve this.

Thanks in advance.

Regards,

Dishant

Super User
Super User
Posts: 7,413

Re: How to stop the saving my code

Hi,

Sorry, I really don't understand the question here, do you mean you want to stop code that is currently running if it encounters an error?  If so then you would need to provide some more specific information such as where the code is running, what it is doing etc.  For instance there is the SYSERR automatic macro variable you could check, something like:

%macro test;

     data a; set b; run;

     %if &syserr.=0 %then %do;  /* If run succesfull */

               ...

     %end;

%mend test;

There maybe other things to consider also though, files being moved, what you are running on etc.

Contributor
Posts: 52

Re: How to stop the saving my code

Hi,

Thanks for looking into my question, Here Criteria is different.

Here While saving my code to XYZ Location, If any error or warning or unwanted note is in my log window, It should not save the code. moreover it should pop-up us with  telling that some error or warning is their in the log.

If any concerns please let me know.

Thanks & Regards,

Dishant

Super User
Super User
Posts: 7,413

Re: How to stop the saving my code

Sorry, again not following you.  Do you mean you are running a program and within a datastep you don't want to store something if there is an error?  If so then this is automatic, SAS wouldn't write a full dataset if there are errors in the datastep.  Do you mean saving your actual program.  Also what do you mean by message should pop up, is this log checking at the end of execution?

Log checking would be something you do at then to see if execution happened correctly, you could do it in a SAS program and email out an message if there are warnings/errors.  Or your batch scheduler could do that.  If you mean when you are running interactively in SAS, then just submit your program step by step (highlight and run), that way only the code you highlight will run.  If you mean saving actual SAS code files then there is no log associated, it is just a plain text file, if you need audit history/rollback etc then look at version control software such as TortoiseSVN to track code files.

Super User
Posts: 6,962

Re: How to stop the saving my code

It's up to you to check the log before saving a program file. Even in EG, you only get a visual signal (red x on errors, yellow exclamation mark on warnings) in certain conditions, NOTEs about unitialized vars etc go unnoticed unless you check the log with eyeballs Mk I. It's what you get paid for as a developer.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 221 views
  • 0 likes
  • 3 in conversation