Published on :
ETL CREATION_INTERNE

Bulk Load Example (BULKLOAD)

This code is also available in: Deutsch Español Français
Awaiting validation
The program begins by deleting an existing DBMS table named 'DUBLKTAB' in the 'mydblib' library to ensure a clean execution. Next, a temporary SAS© dataset, 'work.DUBLKDAT', is created using in-line data (cards). This dataset contains information about individuals (name, age, sex, birth date). The main part of the script uses PROC SQL to create a new table in the database management system (DBMS) specified by 'mydblib'. The BULKLOAD=YES option is used to optimize the data loading process from 'work.DUBLKDAT' to 'mydblib.DUBLKTAB'. Finally, PROC PRINT is used to display the content of the newly loaded 'mydblib.DUBLKTAB' table, formatting the birth date for better readability.
Data Analysis

Type : CREATION_INTERNE


The source data ('work.DUBLKDAT') is created internally within the SAS script using a DATA step and the CARDS statement. It does not come from external sources or default SAS libraries like SASHELP.

1 Code Block
PROC DELETE
Explanation :
This block uses PROC DELETE to delete the 'DUBLKTAB' table from the 'mydblib' library. This ensures that if the table already existed from a previous run, it is removed before being recreated, preventing errors or duplicate data.
Copied!
1PROC DELETE DATA=mydblib.DUBLKTAB;
2RUN;
2 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates a temporary dataset named 'DUBLKDAT' in the 'work' library. The data is provided in-line using the CARDS statement. It defines four variables: 'name' (character), 'age' (numeric), 'sex' (character), and 'bdate' (numeric date, read with the mmddyy. format).
Copied!
1DATA work.DUBLKDAT;
2 INPUT name $ age sex $ bdate mmddyy.;
3 CARDS;
4amy 3 f 030185
5bill 12 m 121277
6charlie 35 m 010253
7david 19 m 101469
8elinor 42 f 080845
9pearl 78 f 051222
10vera 96 f 101200
11frank 24 m 092663
12georgia 1 f 040687
13henry 46 m 053042
14joann 27 f 020461
15buddy 66 m 101432
16;
17RUN;
3 Code Block
PROC SQL
Explanation :
This PROC SQL block creates a new table 'DUBLKTAB' in the 'mydblib' library (which represents a connection to an external database). The 'BULKLOAD=YES' statement is a SAS/ACCESS specific option that enables bulk loading, an optimized method for quickly inserting a large volume of data. The table is created from all columns of the SAS dataset 'work.DUBLKDAT'.
Copied!
1PROC SQL;
2create TABLE mydblib.DUBLKTAB (
3 BULKLOAD=YES
4) as select * from work.DUBLKDAT;
5QUIT;
4 Code Block
PROC PRINT
Explanation :
This block uses PROC PRINT to display the content of the 'mydblib.DUBLKTAB' table that has just been loaded. The 'date7.' format is applied to the 'bdate' variable to display dates in a readable format. A title is also added to the output.
Copied!
1PROC PRINT DATA=mydblib.DUBLKTAB;
2 FORMAT bdate date7.;
3title 'proc print of table';
4RUN;
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