Published on :
ETL INTERNAL_CREATION

In-Stream Data Creation and Display

This code is also available in: Deutsch Español Français
Awaiting validation
The first code block uses a DATA STEP to define and populate the 'instream_mtcars' dataset. The variables 'cars', 'mpg', 'cyl', 'disp', 'hp', and 'drat' are defined, and their values are read from the data lines provided after the CARDS statement. The 'cars' variable is defined with a character format of 12. The second block uses PROC PRINT to generate a formatted list of the 'instream_mtcars' dataset's content, allowing for immediate verification of the created data.
Data Analysis

Type : INTERNAL_CREATION


The data is created and integrated directly into the SAS script via the CARDS statement. No external data source is used.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP is responsible for creating the 'instream_mtcars' dataset. It defines variables and their types (numeric or character with INFORMAT) and reads observations directly from the data lines specified between the CARDS statements and the final semicolon. This method is commonly used for small test or example datasets.
Copied!
1DATA instream_mtcars;
2informat cars$12.;
3INPUT cars$ mpg cyl disp hp drat;
4CARDS; /*cards user to insert instream data*/
5Mercedes_AMG 21 6 160 110 3.9
6BMW_X1_AUTO 22.8 4 108 93 3.85
7;
8RUN;
2 Code Block
PROC PRINT
Explanation :
This PROC PRINT procedure is used to display the content of the 'instream_mtcars' dataset that has just been created. It allows for visual verification that the data has been correctly read and stored in the SAS dataset. The output is typically displayed in the SAS listing file or in the results section of SAS Studio.
Copied!
1PROC PRINT DATA=instream_mtcars;
2RUN;
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.