From sasCommunity
Jump to: navigation, search

This page documents some common errors in SAS, and provides some pointers for resolution.

Cannot Start SAS

ERROR: Invalid physical name for library SASUSER.
FATAL: Unable to initialize the options subsystem.

Cause: invalid argument to option SASuser in Primary Configuration File:

  •  !SASroot\nls\en\SASv9.cfg
/* name: Primary Configuration file for SAS v9.1.3 or SAS v9.2 */
/* Setup the default SAS System user profile folder */

/* Setup the MYSASFILES system variable             */

Solution.1: add these lines to your Secondary config file:

/* name: Secondary Config File !SASroot\SASv9.cfg */
/* [snip] */

-SASUSER        'C:\temp\My SAS Files\9.2\'
-SET MYSASFILES 'C:\temp\My SAS Files\9.2\' /* *** */

Solution.2: when running from a network drive such as Citrix, make sure the My Computer has the correct setting:

Macro statements

Omitting a Semicolon

Missing the semicolon at end of assignment statement

1  %Let Test1 = missing semicolon
2  %Let Test2 = has semicolon;
ERROR: Open code statement recursion detected.

Undefined macro variable

If you haven't previously declared, defined or assigned a value to a macro variable before you use it you can get a warning message about an Apparent symbolic reference to the variable concerned being not resolved. This can also happen if a macro variable is deleted. Such warnings can indicate typographical or logic errors in your code.

23         %let d = b ;
24         %put &=b;
WARNING: Apparent symbolic reference B not resolved.

In this example the line at 24 should be %put &=d;


search SAS-L archives for:

subject: PROC SQL ERROR 65-58: Name too long

ERROR 22-322: Syntax error

This error may be followed by "expecting one of the following: a name, a quoted string, ..." or "expecting one of the following: a name, *."

One of the possible causes of this error is the use of a macro variable (&some_variable_name.) that has not been initialized. This may happen if you copy the code from another source, or if you run a section of code not including the initialization of said macro variable.

This error can also be thrown if a line does not terminate in a semicolon, an unexpected word or identifier is used or there are unmatched parentheses or quotes in the statement.

Another cause is if you use multiple aliases by mistake. If your SELECT statement in a query contains two aliases (like a.b.columnName), perhaps because the code was copied from somewhere else and a second alias was inserted, this error will be thrown.

ERROR 180-322: Statement is not valid or it is used out of proper order.

This SAS blog post tells the interesting story of this common error message that often means "you forgot a semicolon!"

This error may also be encountered if you end a DATA step with a quit; statement rather than a run; statement.

The variable X is uninitialized

If you get this error message in a DATA step, you may have forgotten the SET statement.

For more on this and other errors, see Explaining Unexpected Log Messages and Output Results from DATA Step Code.

See also