You might be the sort of person who loves to wait indefinitely. You visit the DMV regularly to tweak your auto registration. You queue up in the supermarket checkout line behind the customer most likely to require "price checks". You map your daily commute along the routes that offer the least certainty for traffic volume and faulty signals.
But most of us, even as we say we enjoy "living in the moment", like to have some idea about when our current activity will end and we'll be free to move on to the next activity. It's that sense of progress that keeps us going, especially during the work day.
When you run a big long SAS program in SAS Enterprise Guide, and you open the task status window to see how it's going, do you like to see the status as "Running...", whether it's been running for 10 seconds or 10 minutes or an hour? Or would you rather see something more meaningful, such as "10 out 12 steps complete - almost done..."?
If you answered the latter, then you will enjoy the feature in SAS and SAS Enterprise Guide that allows you to instrument your SAS programs to report the current progress within the task status window. This trick is made possible by a SAS global statement, SYSECHO.
The remainder of this post provides instructions and a code example for using the SYSECHO statement. (5 more short paragraphs plus a code block, for those keeping track of blog post status.) You can sprinkle the SYSECHO statement throughout your programs to add more insight into your task status window. However, even though you can use the SYSECHO statement anywhere (it is a global statement), it's most effective if you place it just inside the DATA step or PROC step block.
SAS Enterprise Guide already provides status updates when your program is processing; it reports a status change each time a new step boundary (such as a DATA or PROC step) begins. To preserve a useful SYSECHO status, you need to place the statements after a DATA step or PROC statement. Otherwise, your informative SYSECHO text will be overridden by the more generic "step boundary encountered" status.
When used inside a DATA step, only the last SYSECHO statement will be reflected in the status window. Why? Because SAS global statements are processed at the time that a DATA step is compiled, not as it's being run. So even though your DATA step statements might seem to take a while to run, the SYSECHO statements are not processed in serial within the step -- they are processed all at once, in the beginning.
However, for certain interactive SAS procedures such as PROC SQL, you can use multiple SYSECHO statements to show more status information between statements.
This example program shows a SAS program that has been adorned with SYSECHO statements designed to communicate status information. The program is somewhat contrived, including some SLEEP function calls to simulate longer operations. You can paste this into your SAS Enterprise Guide session and see how it works. Be sure to select View->Task Status to make the task status window visible.
data class (drop=x); sysecho "In the first DATA step"; set sashelp.class; x = sleep(1); run; proc sql; sysecho "Creating the first table, OUT"; create table out as select name, /* Calculation */ (sleep(1)) AS zzzz from class where age>14; sysecho "Creating the second table, OUT2"; create table out2 as select name, /* Calculation */ (sleep(1)) AS zzzz from class where sex="M" and age>14; quit; %macro makedata(count); %do i = 1 %to &count; data outdata&i; sysecho "Making data step &i of &count"; zzz = sleep(3); run; %end; %mend; %makedata(5);