Reputation: 47
I'd like to change library name (a lot tables are assigned to this library). Is it possible to just only 'edit' library name to the new one or is it necessary to create a new library and then moved the tables to it? Will the tables not be damaged when editing the name of an existing library?
Upvotes: 1
Views: 743
Reputation: 27518
LIBNAME Statement
Associates or disassociates a SAS library with a libref (a shortcut name), clears one or all librefs, lists the characteristics of a SAS library, concatenates SAS libraries, or concatenates SAS catalogs.
A LIBRARY is a place in which data sets can be found. The place can be a folder, a json file, an xml file, a remote database or any of numerous others.
A LIBREF is a reference to such a place.
The LIBNAME
statement is used to create a LIBREF and provide any options needed by the library engine that mediates the access to the data sets.
You can have multiple librefs pointing to the same library
LIBNAME zoinks 'c:\projects\x\sasdata';
LIBNAME sweets 'c:\projects\x\sasdata';
You can also have a libref point to more than one place using concatenation
Example:
Suppose some company stores data sets in separate folders according to year and quarter, but you want access to them all through one libref.
LIBNAME INS2020
( 'c:\insurance\2020Q1'
'c:\insurance\2020Q2'
'c:\insurance\2020Q3'
'c:\insurance\2020Q$'
);
A libref is a moniker for data access. Changing (refactoring) the libref is akin to giving someone (or someplace) a better nickname than what was used in the past.
Upvotes: 1
Reputation: 21294
Libraries are pointers to files/locations. You can change the name without impacting any files within the library. You can also have multiple libraries pointing to the same location, though SAS will warn you if you do that.
libname demo '/folders/myfolders/';
*place file in demo;
proc copy in=sashelp out=demo;
select class;
run;quit;
*clear demo;
libname demo;
*assign new library to same location;
libname myFiles '/folders/myfolders/';
*check items;
proc datasets lib=myFiles;run;quit;
Upvotes: 0