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!
data instream_mtcars;
informat cars$12.;
input cars$ mpg cyl disp hp drat;
cards; /*cards user to insert instream data*/
Mercedes_AMG 21 6 160 110 3.9
BMW_X1_AUTO 22.8 4 108 93 3.85
;
run;
1
DATA instream_mtcars;
2
informat cars$12.;
3
INPUT cars$ mpg cyl disp hp drat;
4
CARDS; /*cards user to insert instream data*/
5
Mercedes_AMG 2161601103.9
6
BMW_X1_AUTO 22.84108933.85
7
;
8
RUN;
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!
proc print data=instream_mtcars;
run;
1
PROC PRINTDATA=instream_mtcars;
2
RUN;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.