Published on :
ETL INTERNAL_CREATION

Creating and Displaying Instream Data

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins with a DATA step that reads textual data included via the CARDS statement and assigns them to the specified variables (cars, mpg, cyl, disp, hp, drat) to create the 'instream_mtcars' dataset. Then, a PROC PRINT is used to generate a report displaying all observations and variables of the 'instream_mtcars' dataset in the SAS© output.
Data Analysis

Type : INTERNAL_CREATION


The data is created directly within the SAS script via the CARDS statement in a DATA step. It is therefore an internal data source to the program.

1 Code Block
DATA STEP Data
Explanation :
This block uses a DATA step to create a temporary dataset named 'instream_mtcars'. The variables 'cars' (character), 'mpg', 'cyl', 'disp', 'hp', 'drat' (numeric) are defined. The CARDS statement indicates that the following data lines until a semicolon (;) is encountered are the data to be read and inserted into the dataset. This data represents two car models with their corresponding attributes.
Copied!
1DATA instream_mtcars;
2INPUT cars$ mpg cyl disp hp drat;
3CARDS; /*cards user to insert instream data*/
4Mercedes_AMG 21 6 160 110 3.9
5BMW_X1_AUTO 22.8 4 108 93 3.85
6;
7RUN;
2 Code Block
PROC PRINT
Explanation :
This block uses PROC PRINT to display the content of the 'instream_mtcars' dataset. The 'data=instream_mtcars' option specifies the dataset to be printed. By default, PROC PRINT displays all observations and all variables of the dataset in the output window.
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.