Skip to content

Instantly share code, notes, and snippets.

@statgeek
Created January 9, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save statgeek/22927c1976b14c91dee16ab1ecd0abe7 to your computer and use it in GitHub Desktop.
Save statgeek/22927c1976b14c91dee16ab1ecd0abe7 to your computer and use it in GitHub Desktop.
SAS - track time processes
proc sql;
create table master_process_time
(Entry char(32),
StartTime num format=datetime22.4,
EndTime num format=datetime22.4,
duration num format=32.4,
recordTime num format=datetime22.4);
quit;
%global startTime endTime;
%macro startTiming();
%let startTime = %sysfunc(datetime());
%mend startTiming;
%macro endTiming(entry=);
%let endTime = %sysfunc(datetime());
proc sql;
insert into master_process_time
values("&Entry", &startTime, &endTime, %sysevalf(&endTime - &startTime), %sysfunc(datetime()) );
quit;
%mend;
%startTiming();
proc means data=sashelp.class;
run;
%endTiming(entry=ClassMeans);
%startTiming();
proc tabulate data=sashelp.cars;
class origin make;
var mpg_city mpg_highway;
table origin * make, mpg_city*(mean median N) mpg_highway*(mean median n);
run;
%endTiming(entry=TabulateCars);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment