That will produce the same result as a normal concatenation but of course with one new variable name in place of two different variable names present in the original data set. While we may not change the variable name in the original data sets we can apply the RENAME function in the concatenated data set we create. In the result set and giving missing results for the two variables which differ. In that case a normal concatenation will produce all the variables In this scenario the data sets have same number of variables but a variable name differs between them.
When the above code is executed, we get the following output. In the result the value of DOJ for second data set will appear as missing. In below example the first data set has an extra variable named DOJ. If one of the original data set has more number of variables then another, then the data sets still get combined but in the smaller data set those variables appear as missing. We will consider below many scenarios on this variation. When we have many variations in the data sets for concatenation, the result of variables can differ but the total number of observations in the concatenated data set is always the sum of the observations in each data set. To get the complete details of all the employees we concatenate both the data sets using the SET statement shown as below. įollowing is the description of the parameters used −ĭata-set1,data-set2 are dataset names written one after another.Ĭonsider the employee data of an organization which is available in two different data sets, one for the IT department and another for Non-It department.
The basic syntax for SET statement in SAS is − Ideally all the combining data sets have same variables, but in case they have different number of variables, then in the result all the variables appear, with missing values for the smaller data set. All observations from the first data set are followed by all observations from the second data set, and so on. The total number of observations in the concatenated data set is the sum of the number of observations in the original data sets. Multiple SAS data sets can be concatenated to give a single data set using the SET statement.