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.
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!
data mydblib.compare
work.apd
mydblib.seqtab1 (DBCREATE_TABLE_OPTS="PARTITIONED BY (dealer string)
STORED AS ORC");
input car $ color $ dealer $ sales returns dest $;
cards;
Toyota Red Smith 10000 100 NC
Toyota Red Smith 15000 110 CT
Chevy Green Smith 17000 45 NJ
Ford Blue Smith 12000 0 CA
Toyota Red Jones 4000 20 NC
Ford Blue Finch 10000 400 NC
Toyota Red Smith 10000 100 NJ
Ford White Smith 15000 110 NC
Ford Blue Smith 12000 0 NJ
Toyota Green Jones 4000 20 NC
Toyota Black Jones 4000 20 FL
Toyota Red Jones 4000 20 NC
Ford Blue Finch 10000 400 AL
Chevy White Finch 10000 400 SC
Ford Black Finch 10000 400 SC
Chrysler Blue Finch 20000 400 NC
Chrysler Green Finch 20000 400 CT
Toyota Green Jones 10000 100 NC
Toyota Red Finch 15000 110 CT
Ford Green Smith 17000 45 NJ
;
run;
1
DATA 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 $;
7
CARDS;
8
Toyota Red Smith 10000100 NC
9
Toyota Red Smith 15000110 CT
10
Chevy Green Smith 1700045 NJ
11
Ford Blue Smith 12000 0 CA
12
Toyota Red Jones 400020 NC
13
Ford Blue Finch 10000400 NC
14
Toyota Red Smith 10000100 NJ
15
Ford White Smith 15000110 NC
16
Ford Blue Smith 12000 0 NJ
17
Toyota Green Jones 400020 NC
18
Toyota Black Jones 400020 FL
19
Toyota Red Jones 400020 NC
20
Ford Blue Finch 10000400 AL
21
Chevy White Finch 10000400 SC
22
Ford Black Finch 10000400 SC
23
Chrysler Blue Finch 20000400 NC
24
Chrysler Green Finch 20000400 CT
25
Toyota Green Jones 10000100 NC
26
Toyota Red Finch 15000110 CT
27
Ford Green Smith 1700045 NJ
28
;
29
RUN;
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!
title1 'PROC PRINT OF DBLIB.SEQTAB1';
proc print data=mydblib.seqtab1; run;
1
title1 '
2
PROC PRINT OF DBLIB.SEQTAB1';
3
PROC PRINT
4
DATA=mydblib.seqtab1;
5
6
RUN;
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!
title1 'PROC PRINT OF DBLIB.COMPARE';
proc print data=mydblib.compare; run;
1
title1 '
2
PROC PRINT OF DBLIB.COMPARE';
3
PROC PRINT
4
DATA=mydblib.compare;
5
6
RUN;
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
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.