a subpart of my log file looks as below:
NOTE: PROCEDURE PRINTTO a utilisé (Durée totale du traitement) :
temps réel 0.03 secondes
temps UC 0.00 secondes
...
135 libname deb oracle path=inf1prod;
136 proc sql ;
137 create table deb.doseven as
138 select unique dos_even
139 from deb
140 order by dos_even;
141 quit;
...
NOTE: Format DATHRELOGF is already on the library.
NOTE: Format DATHRELOGF has been output.
NOTE: PROCEDURE FORMAT a utilisé (Durée totale du traitement) :
temps réel 0.00 secondes
temps UC 0.00 secondes
NOTE: Le répertoire «\\spsas002\dfs\data08\commun\demande adhoc\depimput\sortie\@2017\@0831» a bi
en été alloué
NOTE: avec le LIBNAME «sortie».
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :
temps réel 0.04 secondes
temps UC 0.01 secondes
1986
...
NOTE: La table WORK.VSOL22B a été créée, avec 109240546 lignes et 27 col.
NOTE: PROCEDURE SQL a utilisé (Durée totale du traitement) :
temps réel 22:17.96
temps UC 7:07.86
NOTE: There were 109240546 observations read from the data set WORK.VSOL22B.
NOTE: The data set WORK.DEB has 96957638 observations and 34 variables.
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :
temps réel 6:53.72
temps UC 2:16.29
and so on.
I would like to find a way to collect or to import the information into a data set as follow:
procedure temps réel temps uc
(in English)
procedure real time cpu time
proc printto 0.03 0.00
data step 6:53.72 2:16.29
SQL 22:17.96 7:07.86
.
.
.
and so on
Does SAS has a tool or a macro to gather this information into a dataset.
Regards,
Alain
As I appreciate the help of the community members, I would like to share the following code:
%macro LogFile_RealTime(Dir1= , LogFileName =, Minimum_Time= );
data x; /* build SAS dataset */
rownum=_n_;
infile "&Dir1\&LogFileName" truncover ; /* raw file in */
input @1 Texte $120.; /* read a record */
run;
Data Table1;
set x;
if substr(Texte,1,5) eq 'NOTE:' then output Table1;
if substr(Texte,1,10) eq 'temps réel' then output Table1;
if substr(Texte,1,8) eq 'temps UC' then output Table1;
run;
Data Table2;
set x;
if substr(Texte,1,15) eq 'NOTE: PROCEDURE' then output Table2;
if substr(Texte,1,28) eq "NOTE: L'étape DATA a utilisé" then output Table2;
if substr(Texte,1,10) eq 'temps réel' then
DO;
Temps=compress(upcase(texte),'ABCDEFGHIJKLMNOPQRSTUVWXYZÉ');
output Table2;
END;
if substr(Texte,1,8) eq 'temps UC' then
DO;
Temps=compress(upcase(texte),'ABCDEFGHIJKLMNOPQRSTUVWXYZÉ');
output Table2;
END;
run;
Data Table3;
set Table2;
Temps1=put(compress(Temps),$12.);
stimer=input(Temps1,stimer12.);
run;
%macro obscnt(dsn=);
%global nobs dsnid;
%let nobs=.;
%* Open the data set of interest;
%let dsnid = %sysfunc(open(&dsn));
%* If the open was successful get the;
%* number of observations and CLOSE &dsn;
%if &dsnid %then %do;
%let nobs=%sysfunc(attrn(&dsnid,nlobs));
%let rc =%sysfunc(close(&dsnid));
%end;
%else %do;
%put Unable to open &dsn - %sysfunc(sysmsg());
%end;
%* Return the number of observations;
%mend obscnt;
%obscnt(dsn=Table3);
%put &nobs;
Data Table4 (keep= rownum texte);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1 then delete;
if _n_ = Temp2 then delete;
end;
run;
Data Table5(keep= rownum temps1 stimer rename=stimer=Temps_Réel rename=temps1=Temps_Réel_txt);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1-1 then delete;
if _n_ = Temp2 then delete;
end;
run;
Data Table6(keep= rownum temps1 stimer rename=stimer=temps_CPU rename=temps1=Temps_CPU_txt);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1-1 then delete;
if _n_ = Temp1 then delete;
end;
run;
Data global;
merge Table4 Table5 Table6;
run;
proc sort data=global out=rapport;
by descending temps_réel;
run;
Data rapport;
set rapport;
where temps_réel >= &Minimum_Time;
run;
%mend LogFile_RealTime;
%LogFile_RealTime(Dir1=c:\user\LePage , LogFileName=test.log, Minimum_Time= 100);
Regards,
ALP
The FULLSTIMER option will also print additional performance stats. Have a look here...
http://support.sas.com/rnd/scalability/tools/fullstim/index.html
As I appreciate the help of the community members, I would like to share the following code:
%macro LogFile_RealTime(Dir1= , LogFileName =, Minimum_Time= );
data x; /* build SAS dataset */
rownum=_n_;
infile "&Dir1\&LogFileName" truncover ; /* raw file in */
input @1 Texte $120.; /* read a record */
run;
Data Table1;
set x;
if substr(Texte,1,5) eq 'NOTE:' then output Table1;
if substr(Texte,1,10) eq 'temps réel' then output Table1;
if substr(Texte,1,8) eq 'temps UC' then output Table1;
run;
Data Table2;
set x;
if substr(Texte,1,15) eq 'NOTE: PROCEDURE' then output Table2;
if substr(Texte,1,28) eq "NOTE: L'étape DATA a utilisé" then output Table2;
if substr(Texte,1,10) eq 'temps réel' then
DO;
Temps=compress(upcase(texte),'ABCDEFGHIJKLMNOPQRSTUVWXYZÉ');
output Table2;
END;
if substr(Texte,1,8) eq 'temps UC' then
DO;
Temps=compress(upcase(texte),'ABCDEFGHIJKLMNOPQRSTUVWXYZÉ');
output Table2;
END;
run;
Data Table3;
set Table2;
Temps1=put(compress(Temps),$12.);
stimer=input(Temps1,stimer12.);
run;
%macro obscnt(dsn=);
%global nobs dsnid;
%let nobs=.;
%* Open the data set of interest;
%let dsnid = %sysfunc(open(&dsn));
%* If the open was successful get the;
%* number of observations and CLOSE &dsn;
%if &dsnid %then %do;
%let nobs=%sysfunc(attrn(&dsnid,nlobs));
%let rc =%sysfunc(close(&dsnid));
%end;
%else %do;
%put Unable to open &dsn - %sysfunc(sysmsg());
%end;
%* Return the number of observations;
%mend obscnt;
%obscnt(dsn=Table3);
%put &nobs;
Data Table4 (keep= rownum texte);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1 then delete;
if _n_ = Temp2 then delete;
end;
run;
Data Table5(keep= rownum temps1 stimer rename=stimer=Temps_Réel rename=temps1=Temps_Réel_txt);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1-1 then delete;
if _n_ = Temp2 then delete;
end;
run;
Data Table6(keep= rownum temps1 stimer rename=stimer=temps_CPU rename=temps1=Temps_CPU_txt);
set Table3;
do i=1 to &nobs by 3;
Temp1=i+1;
Temp2=i+2;
if _n_ = Temp1-1 then delete;
if _n_ = Temp1 then delete;
end;
run;
Data global;
merge Table4 Table5 Table6;
run;
proc sort data=global out=rapport;
by descending temps_réel;
run;
Data rapport;
set rapport;
where temps_réel >= &Minimum_Time;
run;
%mend LogFile_RealTime;
%LogFile_RealTime(Dir1=c:\user\LePage , LogFileName=test.log, Minimum_Time= 100);
Regards,
ALP
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.
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.