公卫百科  > 所属分类  >  SAS   
[0] 评论[0] 编辑

SAS Data Catalogs

SAS data sets are stored on disk in groups called a data catalog or library. When a data set is created, it can be given either a one level or a two level name.

Data sets given a one level name are part of the catalog called WORK and are erased when the SAS program is exited. Example: data first;. 公卫百科

Data sets with a two level name are stored on disk in a catalog or library which is referred to using a library reference or libref. Two steps are required in order to store a SAS data set on disk.

1. A SAS libref must be created using the libname statement.

公卫论坛



2. The datastep must use a two level name. A two level name is of the form libref.name where name is a usual SAS data set name. Example:


libname jerry `c:\mydata\sasdata\';

data jerry.grades;
...


This creates a SAS data set grades which will be stored on disk in the directory c:\mydata\sasdata. The data set will be available for use in future SAS sessions. Note that the libref will be erased at the end of the current SAS session. 公卫论坛

The data set grades would be used in a new SAS session by first creating an appropriate libref, and then using the corresponding two levle name when invoking a procedure. Example:


libname goody `c:\mydata\sasdata\`;

proc means data=goody.grades; 公卫家园
...


Note that the libref is only required to point to the same subdirectory as when the data set was created.

As a general rule, only data sets that are difficult or time consuming to create or will be used in many different SAS sessions are stored on disk.

公卫论坛



附件列表


0

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

如果您认为本词条还有待完善,请 编辑

上一篇 SAS Character Variables    下一篇 SAS Cards Statement

标签

暂无标签

同义词

暂无同义词