BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
woo
Barite | Level 11 woo
Barite | Level 11

do you think it could be like this for me since i have multiple log error and have already created dataset err_chk_logic.sas7bdat,

DATA ONE;

SET WOO.ERR_CHK_LOGIC;

RUN;

/*  instead of your logic

data a;

  errstring = "ERROR: File WORK.Y.DATA does not exist." ;

run;

*/

/*AND */

PROC SQL NOPRINT;

SELECT QUOTE(TRIM(WOO.ERR_CHK_LOGIC)) INTO :ERRLIST SEPERATED BY ',' FROM A

QUIT;

/*instead of your logic

proc sql noprint;

  select quote(trim(errstring)) into :errlist separated by ',' from a;

quit;

*/

/*AND*/

IF STRING IN :WOO.ERR_CHK_LOGIC THEN DELETE;

RUN;

/instead of your logic

if string in : (&errlist) then delete;  

- SORRY STILL HAVE COFUSION...

Tom
Super User Tom
Super User

You can try that. You need to fix your variable reference in the SQL code.

You using WOO.ERR_CHK_LOGIC which implies that there is a dataset (or an alias) named WOO that contains a variable named ERR_CHK_LOGIC.  But the dataset you are referencing is named A and you are not using any alias with it.

proc sql noprint;

  select quote(trim(err_chk_logic))

    into :errlist seperated by ','

    from a

  ;

quit;

woo
Barite | Level 11 woo
Barite | Level 11

yes tom - as you mentioned i already make a dataset (err_chk_logic.sas7bdat) that had text in it.....now i only need logic to trigger this dataset (err_chk_logic) to check with woo.log if it has same errors with my 'err_chk_logic.sas7bdat' sas dataset and if so - then delete

err_chk_logic.sas7bdat (with variable A and 7 observation ) at my library "c:\woo\err_chk_logic"

---------------------------------------------|

A                                                   |

---------------------------------------------|

error: this is the one error          |

---------------------------------------------|

error: this is the second error   |

---------------------------------------------|

error: this is the third error        |

---------------------------------------------|

.                                                     |

---------------------------------------------|

.                                                     |

---------------------------------------------|

error: this is the seventh error  |

---------------------------------------------

if string in : ("woo.err_chk_logic.sas7bdat") then delete;     /*  -----i need this logic------not sure what it is exactly-------*/

Thanks!

jakarman
Barite | Level 11

Tom I did like your first reply (and Ballards) , asking why this all is needed what problem he is trying to solve.
Woo is saying he is new to SAS is n't it.

We can help him with building the most advanced and nice kind of coding as he asking. We can help him to build something when seen the whole of it all he is doing, is not necessary at all, or is a wrong approach, or an interenal fight to failing IT support, or ... .

It looks like his is trying to build a scheduler solution. Schedulers are standard tools.

- LSF Grid is a approach in SAS.

- Eguide can connect to Windows scheduler

- Eguide has Flow processing that supports running steps/jobs and is dependencies.

It looks like his is trying to analyse errors/warnings in a own approach.

Possible he has already some programming experience and is trying to map that on a SAS environment. Not aware of what SAS offers and is somehow diferent at some areas.

- This is part of SAS and more IT components, but by itself they are not fully errorfree.

- The latest version of Eguide will get Log analyses by it self.

-  Code analyzing and optimizing of old the source approaches (scaproc) is already part of the normal running versions.

Woo what is your issue?

The real problem you are dealing with, not the half way solution you go into by yourself with some coding problems. 

---->-- ja karman --<-----
woo
Barite | Level 11 woo
Barite | Level 11

guys - i really appreciate all your response in this real coding help...especially Tom...I have some experience with coding but i am not that good in MACROS....

my goal is like create a sas dataset with 1 variable and 7 observation (which i already created) ---this dataset will trigger in new logic (which is i am trying to do) to match error in woo.log (of woo.sas) and if error match with dataset (dataset that i have created with errors text = woo.log erros) that i have created then it will delete all errors becasue these errors are exceptional error in our business and no need to consider all these errors...---so here woo.SAS run first which will create woo.log and then new logic will run (by triggering dataset that i have created) - match errors with woo.log and if match then deletes ----

I am in process to do this using Tom logic and all...

Thanks!

Reeza
Super User

I don't think that explains your logic very well, and I think the question still stands. Why do this?

MSGLEVEL settings I assume don't help.

Modified logs bother me a bit, one more step for debugging, fix your code instead usually a better bet.

ballardw
Super User

I think you need to explicitly identify the 7 errors you are looking for. Most condtions that SAS reports as an ERROR will stop execution of a procedure or datastep with no results at all. So I'm not sure how removing references to those types of errors in a log file help.

woo
Barite | Level 11 woo
Barite | Level 11

@ Tom - i think i mix it - are you refeering as following in your code? - see in comment...what is errlist here?

/*

err_chk_logic = variable name

errlist = ?

a= dataset that i have created 

*/

proc sql noprint;

  select quote(trim(err_chk_logic))

    into :errlist seperated by ','

    from a

  ;

quit;

Tom
Super User Tom
Super User
  • ERR_CHK_LOGIC is the name of a variable.
  • A is the name of a dataset.
  • ERRLIST is the name of a macro variable.

This code will place a comma delimited list of quoted strings into the macro variable. 

For example if A looks like

data a;

  input err_chk_logic $50. ;

cards;

error: this is the one error

error: this is the second error

error: this is the third error

run;


Then ERRLIST macro variable will contain:

"error: this is the one error","error: this is the second error","error: this is the third error"

woo
Barite | Level 11 woo
Barite | Level 11

we have %let syscc=0 at end of the program 'woo.sas'...and we have temporary program running right after woo.sas that is xyz.sas which is deleting exception errors from woo.log....

in xyz.sas we have code like --------if string=: "error:........." then delete....---------but instaed of doing this this we wants to create a dataset (a.sas7bdat) of error text which will trigger by xyz.sas -----check woo.sas ------match error with a.sas7bdat dataset -------and if match then delete errors in woo.log --------

---so we have errors but process execute normally...

so i wanted to know what logic/code should look like which will trigger "a.sas7bdat" from "xyz.sas" to see if woo.log has same error as mentioned in a.sas7bdat and then delete.....so basically modifying "xyz.sas"

it would be very simple for you guys as Tom mentioned but still i am not getting it right...

Thanks!

Tom
Super User Tom
Super User

One way to generate code from data is using the SELECT statement with the INTO clause in PROC SQL and then reference the macro variable.

Another way is to just use a SAS data step to write the code.

filename code temp;

data _null_;

  set a ;

  put 'if string='  err_chk_log :$quote. ' then delete;' ;

run;

And then use %INCLUDE to retrieve the code where you need it.

data ....

....

%inc code / source2 ;

...

run;

woo
Barite | Level 11 woo
Barite | Level 11

Thanks a lot Tom - it clears my all doubts...

woo
Barite | Level 11 woo
Barite | Level 11

Hi tom i got it right...used your logic...

--------------------------------------------------------------

filename logfile "c:\woo.log";

libname woo 'c:\woo';

proc sql no print;

select quote (trim(err_chk_logic)) into :errlist

seperated by ' '

from  woo.a;

quit;

data woo.try;

infile logfile end=eof length-length;

input err_chk_logic $varying300. length;

if err_chk_logic="error:";

if err_chk_logic in (&errlist) then delete;

run;

%put &errlist;

--------------------------------------------------------------

here we used one macro variable name, "errlist" to include all my 7 error text messages (7 observation) but what if i want to use different macro variable for each observation (7 observation) using do loop rather than using only one macro variable "errlist" to include all 7 observation in one...

i think this approch would work fine...

to do this i have created another column called 'check' like below....

-------------------                               ----------

err_chk_logic                                  check

-------------------                               ----------

this is the first error                           1

this is the second error                     2

this is the third error                          3

.

.

.

this is the seventh error                    7

NOW my intention is using DO loop and check woo.log by telling SAS - if '1' (which is actually 'this is the first error") in woo.log then delete and samething for other text error messages, like if '7' (which is actually 'this is the seventh error') in woo.log then delete...

Thanks!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 27 replies
  • 2490 views
  • 1 like
  • 6 in conversation