Published on :
Data CREATION_INTERNE

Creation and Display of Instream Data

This code is also available in: Deutsch Español Français
Awaiting validation
The script uses a DATA STEP to define a data structure with the variables 'cars', 'mpg', 'cyl', 'disp', 'hp', and 'drat'. The data for these variables is then read directly from the 'cards' section. Once the dataset is created, PROC PRINT is used to display the formatted content of the 'instream_mtcars' dataset in the log or default output.
Data Analysis

Type : CREATION_INTERNE


The data is defined directly in the SAS script via the 'cards;' instruction within a DATA STEP, which means it is created and loaded into memory during script execution.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates the 'instream_mtcars' dataset. It uses the 'informat' statement to specify the format of the 'cars' variable and 'input' to define the order and type of variables. The 'cards;' statement indicates that the following lines contain the data to be read directly into the dataset.
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 block uses PROC PRINT to display the content of the 'instream_mtcars' dataset. This is a standard procedure for quickly viewing data from a SAS table.
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.