As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

SYSRC automatic macro variable

From sasCommunity
Jump to: navigation, search
This is a Work in Progress. Please contribute to this article.

SYSRC automatic macro variable is populated with a return code that corresponds to any ERRORLEVEL value returned when an operating system command is executed by certain SAS statements. The value that SYSRC returns depends on the underlying operating system.

Default value

The default value of 0 is returned if no operating system command has been executed, or if an operating system command is executed asynchronously when the NOXSYNC system option is set.


The SYSRC automatic macro variable can be checked to determine if an operating system command has executed correctly. The check should be performed immediately after the SAS statement that executes the operating system command.

To display the SYSRC automatic macro variable in the log use the following macro code.


Other language elements named SYSRC

SYSRC automatic macro variable should not be confused with the %SYSRC autocall macro that translates mnemonic text strings into return codes produced by SCL functions.

See also

Further reading

sasCommunity articles

External links

SAS Documentation