Published on :
ETL CREATION_INTERNE

Creation of a 'ratings' dataset

This code is also available in: Deutsch Español Français
Awaiting validation
The script uses a DATA STEP to define the structure of the 'ratings' dataset with 'stars' (numeric) and 'rating' (character) variables. The data is then inserted directly into the dataset via the DATALINES statement, using commas as delimiters (DSD - Delimited, Separated, Data).
Data Analysis

Type : CREATION_INTERNE


Data is created directly within the SAS script using the DATALINES statement. It does not come from an external source or from default SAS libraries like SASHELP.

1 Code Block
DATA STEP Data
Explanation :
This code block uses a DATA STEP to create a temporary SAS dataset named 'ratings'. The 'length' statement defines the types and lengths of the 'stars' (8-byte numeric) and 'rating' (15-character) variables. 'infile datalines dsd;' indicates that the raw data is provided within the script itself (datalines) and that the delimiter is a comma, also handling quotes. 'input stars rating;' associates the read data with the variables. The lines following 'datalines;' are the inserted observations.
Copied!
1DATA ratings;
2LENGTH stars 8 rating $ 15;
3INFILE DATALINES dsd;
4INPUT stars rating;
5DATALINES;
61, Hated it
72, Didn't like it
83, Liked it
94, Really liked it
105, Loved it
11;
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.