Published on :
Data Creation CREATION_INTERNE

Creation of 'cities' dataset

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© script uses a DATA STEP to read raw data provided via the DATALINES statement. It defines four variables: 'Year' (numeric), 'City' (character, read from columns 4 to 16, allowing to capture city names with spaces), 'Name1' (character) and 'Name2' (character). The 'cities' dataset is then created and populated with the specified observations.
Data Analysis

Type : CREATION_INTERNE


The data is provided directly in the SAS script via the DATALINES statement. The 'cities' dataset is created internally without dependence on external files or existing SAS libraries (other than default WORK).

1 Code Block
DATA STEP Data
Explanation :
This code block is a DATA STEP that aims to create a new permanent or temporary dataset ('cities').
- The `INPUT Year City $ 4-16 Name1 $ Name2 $;` statement reads the raw data. 'Year' is read as a numeric variable. 'City' is read as a character variable (indicated by '$') from columns 4 to 16 of the data line. 'Name1' and 'Name2' are also read as character variables.
- The `DATALINES;` statement indicates that the data to be read follows immediately in the script, up to the semicolon statement on a single line.
- `RUN;` executes the DATA STEP, creating the 'cities' dataset with the provided observations.
Copied!
1DATA cities;
2 INPUT Year City $ 4-16 Name1 $ Name2 $;
3 DATALINES;
418 San Diago Rebecca Marian
519 San Fancisco Kathy Ginger
620 Long Beach Scott Sally
721 Las Vegas Cynthia MaryAnne
822 San Jose Ethan Frank
9;
10RUN;
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.