Published on :
ETL/Reporting INTERNAL_CREATION

Creation of partitioned ORC data

This code is also available in: Deutsch Español Français
Awaiting validation
Attention : This code requires administrator privileges.
This SAS© script demonstrates the creation of ORC (Optimized Row Columnar) tables partitioned by the 'dealer' variable. It uses inline data (`cards;`) to populate the `mydblib.compare` and `mydblib.seqtab1` tables. The script also includes initial cleaning steps (`proc delete`) and verification of the created data (`proc print`). It is intended to be executed after submitting the `createLibname` program to establish the database connection via `mydblib`.
Data Analysis

Type : INTERNAL_CREATION


Data is defined directly in the script via a `cards;` clause in a DATA STEP. It is then used to create tables.

1 Code Block
PROC DELETE
Explanation :
Deletes existing `mydblib.seqtab1` and `mydblib.compare` tables in the `mydblib` library to ensure a clean environment before creating new data.
Copied!
1 
2PROC DELETE
3DATA=mydblib.seqtab1;
4 
5RUN;
6PROC DELETE
7DATA=mydblib.compare;
8 
9RUN;
10 
2 Code Block
DATA STEP Data
Explanation :
This DATA STEP creates three tables: `mydblib.compare`, `work.apd`, and `mydblib.seqtab1`. The `mydblib.seqtab1` table is configured to be an ORC table partitioned by the `dealer` column in the underlying database system (likely Hadoop). Data is read from the provided lines (`cards;`) and assigned to the specified variables.
Copied!
1DATA mydblib.compare
2 work.apd
3 mydblib.seqtab1 (DBCREATE_TABLE_OPTS="PARTITIONED BY (dealer string)
4 STORED AS ORC");
5 
6 INPUT car $ color $ dealer $ sales returns dest $;
7CARDS;
8Toyota Red Smith 10000 100 NC
9Toyota Red Smith 15000 110 CT
10Chevy Green Smith 17000 45 NJ
11Ford Blue Smith 12000 0 CA
12Toyota Red Jones 4000 20 NC
13Ford Blue Finch 10000 400 NC
14Toyota Red Smith 10000 100 NJ
15Ford White Smith 15000 110 NC
16Ford Blue Smith 12000 0 NJ
17Toyota Green Jones 4000 20 NC
18Toyota Black Jones 4000 20 FL
19Toyota Red Jones 4000 20 NC
20Ford Blue Finch 10000 400 AL
21Chevy White Finch 10000 400 SC
22Ford Black Finch 10000 400 SC
23Chrysler Blue Finch 20000 400 NC
24Chrysler Green Finch 20000 400 CT
25Toyota Green Jones 10000 100 NC
26Toyota Red Finch 15000 110 CT
27Ford Green Smith 17000 45 NJ
28;
29RUN;
3 Code Block
PROC PRINT
Explanation :
Displays the content of the `mydblib.seqtab1` table using PROC PRINT, with a title 'PROC PRINT OF DBLIB.SEQTAB1' to identify it in the output.
Copied!
1title1 '
2PROC PRINT OF DBLIB.SEQTAB1';
3PROC PRINT
4DATA=mydblib.seqtab1;
5 
6RUN;
7 
4 Code Block
PROC PRINT
Explanation :
Displays the content of the `mydblib.compare` table using PROC PRINT, with a title 'PROC PRINT OF DBLIB.COMPARE' to identify it in the output.
Copied!
1title1 '
2PROC PRINT OF DBLIB.COMPARE';
3PROC PRINT
4DATA=mydblib.compare;
5 
6RUN;
7 
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.
Copyright Info : S A S S A M P L E L I B R A R Y PRODUCT: SAS/ACCESS to Hadoop