SAS Institute. The Power to Know

FOCUS AREAS

Hot Topics

Related Links

Files

Migration

Updating SAS Code

SAS programs are commonly saved as text files, with a .SAS file extension, to be run in batch mode. You might also own custom applications that contain SAS code. PROC MIGRATE does not move SAS programs to the target installation. Instead, you must use your normal transfer tool, such as an FTP tool.

Whenever you move existing SAS programs to a different installation, you might have to tweak the code to make it run correctly. This topic covers the changes to make for SAS®9 and for the particulars of the target operating environment. For other SAS products, see Product-Specific Compatibility Issues.

About SAS Component Language (SCL) code

Most of the issues on this page apply to SCL code as well. SCL code generally exists as catalog entries, but it can also be stored in an external text file that is called by an %INCLUDE command. Any change you make to SCL code requires a recompile to pick up the changes.

See SAS®9 Compatibility to determine whether your catalogs are foreign files. SAS®9 does not support update processing for foreign catalogs, so you must migrate foreign SCL catalog entries to SAS®9 format in order to edit them.

Compatibility Issues

Here are the few known compatibility issues. Programs that you created in a previous version of SAS will run correctly in the target SAS®9 installation when you make the following changes.

z/OS
See also z/OS Compatibility Issues for additional changes that are specific to the z/OS family.

Hardcoded values
Fix any hardcoded values such as pathnames, engine names, values specific to the operating environment, and so forth.
  • Pathnames can appear many language elements, for example, SAS options; LIBNAME, FILENAME, FILE, and INFILE statements; and FILENAME and PATHNAME functions, to name just a few. Also look for pathnames in macro variables.
  • When you use PROC MIGRATE, embedded librefs associated with a SAS data view are not changed when migrated.
  • You might choose to specify the engine name in a program to get version-specific processing, for example, the V6 compatibility engine.
  • If you alter or update the operating environment, then any SAS code that directly calls operating environment commands (for example, manipulating files, printing) must be recoded to the new operating environment's commands. See your SAS Companion for language elements that are specific to an operating environment.

SAS macros
Beginning in SAS 9.1, the IN (#) operator is supported in macro expressions. SAS 9.0 and previous versions did not support it. Because IN and # now have meaning to the expression evaluator, any time these values appear in an expression context and are not meant as the IN operator, you must quote the values using either one of the macro quoting functions or double quotation marks. For example, the expressions
   &state=in
   &var = #
must be recoded as
   %quote(&state) = %quote(in)
   %quote(&var) = %quote(#)
or
   "&state"="in"
   "&var" = "#"
Output Delivery System (ODS)
Starting in SAS 9.1, ODS generates HTML 4.0 output by default instead of HTML 3.2 when you issue the ODS HTML statement. This can be important, for example, when you use the NOTOP argument. Some formatting specifications have been moved to the cascading style sheet (CSS). Therefore, if your code includes NOTOP, then you do not get the CSS formatting unless you specify the HTML 3.2 standards.

If this is an issue, then your choices are to update existing ODS code to the HTML 4.0 standard, or to issue the ODS HTML3 statement, or to toggle the registry entry to HTML3 (which makes it the default).

For more differences in ODS between SAS 8.2 and SAS 9.1, see the paper A Soft Landing to ODS 9.1.

National language support (NLS)
If you take advantage of the multilingual capabilities of SAS, see information about a few migration issues that are a result of SAS®9 enhancements.

SAS®9 changes and enhancements
  • Refer to the SAS Procedures Guide and Language Reference: Dictionary for any functionality changes in procedures, statements, and options. For example, in the APPEND statement of the DATASETS procedure, the default append behavior changed to improve performance, beginning in Version 7. If the old behavior is required for some reason, you can specify APPENDVER=V6.

  • If you don't migrate your data to SAS®9 format, beware of using any new functionality in your SAS programs and applications that does not work against the old SAS files. For example, the DATECOPY option is not supported when you use the COPY procedure and the XPORT engine to create a Version 6 or 7 file; and longer format or informat names are not supported in releases prior to SAS®9. For a brief summary of compatibility issues, see the topics that link from SAS®9 Compatibility, and refer to SAS documentation for full details.

  • See also product-specific compatibility issues.

User-defined names
For every SAS release since your source installation, see the What's New documentation for new functions, CALL routines, macros, formats, and informats. SAS names generally take precedence over user-defined names. In other words, if your existing SAS code contains a user-defined name, and that name is identical to a new SAS name, then you might encounter an error.
Best practices

Search SAS code. Make a list of problematic SAS language elements and use a search tool (like GREP under UNIX) to scan external files for SAS code to change. Be aware that such a tool cannot search catalog entries, so it will not search SCL code unless the code is in an external text file. To search SCL catalog entries, you can open an entry and use the editor's search feature.

Use your employees' experience. Identify a staff member who has previously updated SAS programs to use in a later version. Use this person as a resource to train others in what changes to look for.

Use correct coding in any new programs. When using a PUT statement to write a character string followed by a variable name, it's a good coding practice to always type a blank space between the string and the variable. In SAS®9 a new note reminds you of this. See the SAS documentation of the PUT statement for details.