Data Creation and WORK Library Management

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
This SAS© script is composed of two main blocks. The first block uses a DATA step to create a temporary dataset 'THREEROWS' directly from embedded data via the CARDS statement. This dataset contains three observations with variables _STATE, SEX1, and _AGE80. The second block executes the PROC DATASETS procedure on the 'WORK' library. Without additional options specified, this procedure primarily acts as a synchronization or refresh point for the WORK library, although it can be used for dataset management (renaming, deleting, etc.) with specific options.
Data Analysis

Type : CREATION_INTERNE


The data for the THREEROWS dataset is created directly within the SAS script using DATA STEP and CARDS statements.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates a new dataset named THREEROWS in the WORK library. The data for this dataset is read directly from the lines following the CARDS statement, defining three variables (_STATE, SEX1, _AGE80) for three observations.
Copied!
1DATA THREEROWS;
2 INFILE CARDS;
3 INPUT _STATE SEX1 _AGE80;
4 CARDS;
512 1 72
625 2 25
727 2 54
8;
2 Code Block
PROC DATASETS
Explanation :
This block executes the PROC DATASETS procedure on the SAS 'WORK' library. In the absence of specific options (such as DELETE, CHANGE, CONTENTS, etc.), this execution often serves to interact with the library's properties or to ensure it is updated after previous operations. The QUIT; and RUN; statements terminate the procedure.
Copied!
1PROC DATASETS LIB = WORK;
2QUIT;
3RUN;
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.

Related Documentation

Aucune documentation spécifique pour cette catégorie.