Published on :
Data Management CREATION_INTERNE

Example 5: Describing a SAS Data Set

This code is also available in: Deutsch Español Français
The DATASETS procedure is used to manage SAS© libraries and library members. The CONTENTS statement is used to display the metadata of a SAS© data set, including variable names, types, formats, labels, and other relevant information. The NOLIST option suppresses the display of the library member list, while the OUT=grpout option creates a new data set containing the metadata of the 'group' data set.
Data Analysis

Type : CREATION_INTERNE


The example uses a data set referenced by a 'health' library. The creation of the 'group' data set is not directly provided in this example, but it is assumed to have been created in a previous example ('Modifying SAS Data Sets'). For autonomy, it would be preferable to recreate a simple data set. However, as it refers to a previous modification, it is considered part of a coherent flow of examples and does not require undefined external data.

1 Code Block
PROC DATASETS
Explanation :
This code block configures system options for display (page size, line size, date suppression, and initial page number). It then defines a SAS library named 'health'. The DATASETS procedure is called with the 'library=health' option to specify the library to manage and 'nolist' to avoid displaying the full list of library members. The CONTENTS statement is used to display information about the 'group' data set. The '(read=green)' option indicates that the 'group' data set is read-only, and 'out=grpout' creates a new data set 'grpout' which will contain the metadata of the 'group' data set.
Copied!
1options pagesize=40 linesize=80 nodate pageno=1;
2 
3LIBNAME health 'SAS-library';
4PROC DATASETS library=health nolist;
5 contents DATA=group (read=green) out=grpout;
6 title 'The Contents of the GROUP Data Set';
7RUN;
8QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright © SAS Institute Inc. All Rights Reserved