Functions and CALL Routines |
Category: | External Files |
Category: | SAS File I/O |
See: | The RENAME Function under OpenVMS |
Syntax |
RENAME(old-name, new-name <, type<, description <, password <, generation>>>>) |
specifies a character constant, variable, or expression that is the current name of a member of a SAS library, an entry in a SAS catalog, an external file, or an external directory.
For a data set, old-name can be a one-level or two-level name. For a catalog entry, old-name can be a one-level, two-level, or four-level name. For an external file or directory, old-name must be the full pathname of the file or the directory. If the value for old-name is not specified, then SAS uses the current directory.
specifies a character constant, variable, or expression that is the new one-level name for the library member, catalog entry, external file, or directory.
is a character constant, variable, or expression that specifies the type of element to rename. Type can be a null argument, or one of the following values:
ACCESS |
specifies a SAS/ACCESS descriptor that was created using SAS/ACCESS software. |
CATALOG |
specifies a SAS catalog or catalog entry. |
DATA |
specifies a SAS data set. |
VIEW |
specifies a SAS data set view. |
FILE |
specifies an external file or directory. |
Default: | 'DATA' |
specifies a character constant, variable, or expression that is the description of a catalog entry. You can specify description only when the value of type is CATALOG. Description can be a null argument.
is a character constant, variable, or expression that specifies the password for the data set that is being renamed. Password can be a null argument.
is a numeric constant, variable, or expression that specifies the generation number of the data set that is being renamed. Generation can be a null argument.
Details |
You can use the RENAME function to rename members of a SAS library or entries in a SAS catalog. SAS returns 0 if the operation was successful, and a value other than 0 if the operation was not successful.
To rename an entry in a catalog, specify the four-level name for old-name and a one-level name for new-name. You must specify CATALOG for type when you rename an entry in a catalog.
Operating Environment Information: Use RENAME in directory-based operating environments only. If you use RENAME in a mainframe operating environment, SAS generates an error.
Examples |
The following examples rename a SAS data set from DATA1 to DATA2, and also rename a catalog entry from A.SCL to B.SCL.
rc1=rename('mylib.data1', 'data2'); rc2=rename('mylib.mycat.a.scl', 'b', 'catalog');
The following examples rename external files.
/* Rename a file that is located in another directory. */ rc=rename('/local/u/testdir/first', '/local/u/second', 'file'); /* Rename a PC file. */ rc=rename('d:\temp', 'd:\testfile', 'file');
The following example renames a directory in the UNIX operating environment.
rc=rename('/local/u/testdir/', '/local/u/oldtestdir', 'file');
The following example renames the generation data set WORK.ONE to WORK.TWO, where the password for WORK.ONE#003 is my-password.
rc=rename('work.one','two',,,3,'my-password');
See Also |
Functions: |
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.