The script starts by defining a libname 'mylib' pointing to the '/folders/myfolders/' folder. Then, a DATA step is used to create the 'mylib.class1' table. Data is provided directly in the script via the `cards` statement, with variables cars (character), mpg, cyl, disp, hp, and drat (numeric). Two observations are inserted into the table.
Data Analysis
Type : CREATION_INTERNE
Data is provided directly in the SAS script via the `cards` (datalines) statement, meaning it is internally created without external dependency on a pre-existing data source.
1 Code Block
Libname Statement
Explanation : Defines the SAS library 'mylib' which points to the file path '/folders/myfolders/'. This allows access to files in this directory and storing new tables there via the 'mylib' libref.
Copied!
libname mylib "/folders/myfolders/";
1
LIBNAME mylib "/folders/myfolders/";
2 Code Block
DATA STEP Data
Explanation : This DATA step creates a new SAS table named 'class1' in the 'mylib' library. The `input` statement defines the variables (cars as a character string '$', and mpg, cyl, disp, hp, drat as numeric) and their order. The `cards` statement indicates that the following data, up to the semicolon and `run;`, is instream data to be read to create the table observations.
Copied!
data mylib.class1;
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 mylib.class1;
2
INPUT cars$ mpg cyl disp hp drat;
3
CARDS; /*cards user to insert instream data*/
4
Mercedes_AMG 2161601103.9
5
BMW_X1_AUTO 22.84108933.85
6
;
7
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.