The topic has been discussed in so many SAS papers. Below are my considerations:
1. X statement / X command
It is the most popular one. I always use it in interactive mode.
However, I would suggest that we should not use it in batch since it is difficult to control task and get status.
2. %SYSEXEC macro statement
As you know, macro string quoting always a challenge to SAS programmer. If there is any special character in the command, it may take you much time for troubleshooting. To make the code clean and readable, I prefer not using %SYSEXEC in our production code.
3. SYSTEM function / CALL SYSTEM routine
It works good with DATA step.
4. FILENAME statement PIPE engine
It is convenient to get the output of command.
Tip: to get the return code of the command, we can use this:
FILENAME CMD PIPE "command; echo $?";
5. SYSTASK statement
It is my favorite one. It is because you will have more control on the command: execute many tasks in parallel, list tasks, kill task, and get status easily. Furthermore, it is the only way to execute command asynchronously.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment