- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am using the following SAS code
proc printto log="/var/opt/data/data_project/sas94/bire/redwh/logs/PooledWorkspaceServer/one.log";
run;
data one;
Input A B $;
Datalines;
1 A
2 b
;
run;
Here I can save my report log to somewhere.
I want to know that can you suggest me some sort of code where I can scan some test from that log file. I need to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Log files are just text files. You can read in the text file, and process it how you like with string functions:
data want; infile ".../one.log"; length instr $2000; input instr $; ... run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Using @RW9 's skeleton i'd continue using regular expressions so scan the data:
https://support.sas.com/rnd/base/datastep/perl_regexp/regexp-tip-sheet.pdf
//Fredrik
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Actually I want to scan the log from that path, and then if error will be there, respect to some specific error like "Statement is not valid or it is used out of proper order"(suppose) then it will shoot one mail to me or user.
Note: I want to specify the error test in the condition. Not for all error.
I have used another sort of code. Here can we do anything?
Options obs=max nosymbolgen nomlogic nomprint;
%INCLUDE "/home/name/Test.sas";
%Let Joblog = /home/name/;
%Let Jobdate = &sysdate9.;
%Let Jobname = RUN_LoadTB_Refresh;
%LOGCHECK(&joblog.&JOBNAME._&jobdate..log,name);
run;
Please help me.
Thanks
Regards
Sourav
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What kind of report do you want to build?
It seems you are on Intelligence architecture, so if you have a quite recent release, you should be able to do stuff with Environment Manager OOTB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am working in SAS EG, and I am running some prompt related to this report through DI studio. But if I want to run the code only from EG, above sort of code I am using, but not able to specify the error text. My aim is to specify the error text in the code, and to get mail respect that error only from the log...
If there any possibilities that we can mention the error text in the condition or in the loop, instead of any error code no, please let me know, I am chasing for this issue for long time, I need one permanent solution on this...
Regards
Sourav
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Look in to the following code
Filename _log_ "/home/re00627/test.log";
Data Log1;
Infile _log_ truncover;
input a_line $200.;
/*If Substr(a_line,1,57) = 'Statement is not valid or it is used out of proper order.'*/
/**/
if index(a_line, 'Statement is not valid or it is used out of proper order.') > 0
then Do;
/*index(a_line, 'WARNING') > 0*/
filename myfile email
to= "mail_id"
subject= "Error in Report"
type= "text/plain"
importance="HIGH";
data _null_;
file myfile;
put 'Dear User';
put;
put 'Due to your selection you are getting this mail.';
put;
put 'Please go with some short selction.';
run;
End;
This code is not working, Here can you help me with some other option. If I am using, neither the index function is working nor SUSTR, if you have some easy solution please let e know.