29.12.2013 Views

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

314 APPEND Statement 4 Chapter 15<br />

3 If formats in the DATA= data set are different from those in the BASE= data set,<br />

then the formats in the BASE= data set are used. However, <strong>SAS</strong> does not convert<br />

the data from the DATA= data set in order to be consistent with the formats in the<br />

BASE= data set. The result could be data that appears to be incorrect. A warning<br />

message is displayed in the <strong>SAS</strong> log. The following example illustrates appending<br />

data by using different formats:<br />

data format1;<br />

input Date date9.;<br />

format Date date9.;<br />

datalines;<br />

24sep1975<br />

22may1952<br />

;<br />

data format2;<br />

input Date datetime20.;<br />

format Date datetime20.;<br />

datalines;<br />

25aug1952:11:23:07.4<br />

;<br />

proc append base=format1 data=format2;<br />

run;<br />

The following messages are displayed in the <strong>SAS</strong> log.<br />

Output 15.2<br />

Warning Message in <strong>SAS</strong> Log<br />

NOTE: Appending WORK.FORMAT2 to WORK.FORMAT1.<br />

WARNING: Variable Date has format DATE9. on the BASE data set<br />

and format DATETIME20. on the DATA data set. DATE9. used.<br />

NOTE: There were 1 observations read from the data set WORK.FORMAT2.<br />

NOTE: 1 observations added.<br />

NOTE: The data set WORK.FORMAT1 has 3 observations and 1 variables.<br />

3 If the length of a variable is longer in the DATA= data set than in the BASE= data<br />

set, or if the same variable is a character variable in one data set and a numeric<br />

variable in the other, use the FORCE option. Using FORCE has these<br />

consequences:<br />

3 The length of the variables in the BASE= data set takes precedence. <strong>SAS</strong><br />

truncates values from the DATA= data set to fit them into the length that is<br />

specified in the BASE= data set.<br />

3 The type of the variables in the BASE= data set takes precedence. The<br />

APPEND statement replaces values of the wrong type (all values for the<br />

variable in the DATA= data set) with missing values.<br />

Appending Data Sets That Contain Integrity Constraints<br />

If the DATA= data set contains integrity constraints and the BASE= data set does<br />

not exist, the APPEND statement copies the general constraints. Note that the<br />

referential constraints are not copied. If the BASE= data set exists, the APPEND action<br />

copies only observations.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!