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!
proc delete data=mydblib.DUBLKTAB;
run;
1
PROC DELETEDATA=mydblib.DUBLKTAB;
2
RUN;
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!
data work.DUBLKDAT;
input name $ age sex $ bdate mmddyy.;
cards;
amy 3 f 030185
bill 12 m 121277
charlie 35 m 010253
david 19 m 101469
elinor 42 f 080845
pearl 78 f 051222
vera 96 f 101200
frank 24 m 092663
georgia 1 f 040687
henry 46 m 053042
joann 27 f 020461
buddy 66 m 101432
;
run;
1
DATA work.DUBLKDAT;
2
INPUT name $ age sex $ bdate mmddyy.;
3
CARDS;
4
amy 3 f 030185
5
bill 12 m 121277
6
charlie 35 m 010253
7
david 19 m 101469
8
elinor 42 f 080845
9
pearl 78 f 051222
10
vera 96 f 101200
11
frank 24 m 092663
12
georgia 1 f 040687
13
henry 46 m 053042
14
joann 27 f 020461
15
buddy 66 m 101432
16
;
17
RUN;
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!
proc sql;
create table mydblib.DUBLKTAB (
BULKLOAD=YES
) as select * from work.DUBLKDAT;
quit;
1
PROC SQL;
2
create TABLE mydblib.DUBLKTAB (
3
BULKLOAD=YES
4
) as select * from work.DUBLKDAT;
5
QUIT;
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!
proc print data=mydblib.DUBLKTAB;
format bdate date7.;
title 'proc print of table';
run;
1
PROC PRINTDATA=mydblib.DUBLKTAB;
2
FORMAT bdate date7.;
3
title 'proc print of table';
4
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.