Sample 24588: Using the SET statement to concatenate data sets
Use the SET statement to concatenate data sets.
Note: Concatenating data sets is the combining of two or more data sets, one after the other, into a single data set. The number of observations in the new data set is the sum of the number of observations in the original data sets. The order of observations is sequential. All observations from the first data set are followed by all observations from the second data set.
The sequence of variables on the SAS data sets is immaterial. SAS matches variable names to append the DATA.
See also PROC APPEND in the SAS Procedures Guide.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data one;
input name $ age;
datalines;
Chris 36
Jane 21
Jerry 30
Joe 49
;
data two;
input name $ age group;
datalines;
Daniel 33 1
Terry 40 2
Michael 60 3
Tyrone 26 4
;
data both;
set one two;
run;
proc print data=both;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs name age group
1 Chris 36 .
2 Jane 21 .
3 Jerry 30 .
4 Joe 49 .
5 Daniel 33 1
6 Terry 40 2
7 Michael 60 3
8 Tyrone 26 4
Type: | Sample |
Topic: | SAS Reference ==> DATA Step SAS Reference ==> Statements ==> File-handling ==> SET Common Programming Tasks ==> Combining Data
|
Date Modified: | 2021-07-08 13:34:27 |
Date Created: | 2004-09-30 14:08:56 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |