Chapter Contents

Previous

Next
RENAME

RENAME



Renames a member of a SAS data library, an external file, or a directory

Category: Utility


Syntax
Details
Examples
Example 1: Renaming Tables and Catalog Entries
Example 2: Renaming an External File
Example 3: Renaming a Directory
Example 4: Renaming a Data Set Generation
See Also

Syntax

sysrc=RENAME(old-name,new-name<,type<,description<,generation<,password>>>>);

sysrc
contains the return code for the operation:

Type: Numeric
0 successful
[ne]0 not successful

old-name
is the current name of a member of a SAS data library, an external file, or an external directory. For a member, this can be a one-, two-, or four-level name. For an external file or a directory, old-name must be the full pathname of the file or a directory; otherwise, the current directory is used.

Type: Character

new-name
is the new one-level name for the library member, external file, or directory.

Type: Character

type
specifies the type of element to rename:

Type: Character

'ACCESS'
an access descriptor that was created using SAS/ACCESS software

'CATALOG'
a SAS catalog or catalog entry

'DATA'
a SAS table (This is the default.)

'VIEW'
a SAS table view

'FILE'
an external file or a directory.

description
is the description of a catalog entry. You can specify description only when type is CATALOG.

Type: Character

password
is the password for the file that is being renamed.

Type: Character

generation
is the generation number of the data set that is being renamed.

Type: Numeric


Details

You can use RENAME to rename files or directories that are external to a SAS session as well as members of a SAS data library.

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 renaming an entry in a catalog.


Examples

Example 1: Renaming Tables and Catalog Entries

Rename a SAS table from DATA1 to DATA2. Also rename a catalog entry from A.SCL to B.SCL.

rc1=rename('mylib.data1','data2');
rc2=rename('mylib.mycat.a.scl','b','catalog');

Example 2: Renaming an External File

Rename an external file:

   /* rename a file that is in another directory */
rc=rename('/local/u/testdir/first',
          '/local/u/second','file');
   /* rename a PC file */
rc=rename('d:\temp','d:\testfile','file');

Example 3: Renaming a Directory

Rename a directory:

rc=rename('/local/u/testdir/','/local/u/oldtestdir','file');

Example 4: Renaming a Data Set Generation

Rename a generation of the data set work.one to work.two, where the password for work.one#003 is "blahblah":

rc=rename('work.one','two','data',",'blahblah',3);

See Also

DELETE


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.