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!
DATA cities;
INPUT Year City $ 4-16 Name1 $ Name2 $;
DATALINES;
18 San Diago Rebecca Marian
19 San Fancisco Kathy Ginger
20 Long Beach Scott Sally
21 Las Vegas Cynthia MaryAnne
22 San Jose Ethan Frank
;
RUN;
1
DATA cities;
2
INPUT Year City $ 4-16 Name1 $ Name2 $;
3
DATALINES;
4
18 San Diago Rebecca Marian
5
19 San Fancisco Kathy Ginger
6
20 Long Beach Scott Sally
7
21 Las Vegas Cynthia MaryAnne
8
22 San Jose Ethan Frank
9
;
10
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.