![]() If the datasets contain the same variable names, but the formats, labels, and/or lengths are different for any given variable, the new dataset will use the definitions from the dataset listed first in the SET statement.If the datasets have different variable names, the new dataset will include all variable names and assign missing values where appropriate.The dataset names in the list are separated by a space.Īlthough this code is simple, there are a few things to keep in mind when combining datasets this way. The code above is just an extension of the basic SET statement, but instead of having one dataset listed after the SET keyword, there are two or more datasets listed. SET Dataset-Name-1 (OPTIONS) Dataset-Name-2 (OPTIONS) When you have two or more datasets with the same structure, then you can combine them using the SET statement within a data step: DATA New-Dataset-Name (OPTIONS) You may want to combine these records into a single dataset by "appending" one dataset to the bottom of the other. This may happen if you have to researchers collecting observations at different locations or times. Suppose you have two or more datasets with the same structure (i.e., completely identical variables) but different cases (i.e., the rows in each dataset are unrelated to one another). For example, you may have demographic information about customers in one dataset, and transaction information in a second dataset both datasets will have a "customer ID" variable that uniquely identifies who made the purchase, but the variables in each dataset will be different. Merging is useful when you have relevant information stored in separate data sources. This can happen if you have datasets covering different time periods, and want to analyze trends over time: in order to do so, you'll need to put all of the time periods into a single dataset for analysis. Match-merging: Joining the datasets in such a way that one or more cases from one dataset can be matched to one or more cases in a second dataset, based on a uniquely identifying ID variable in both datasetsĪppending is useful when you have two or more datasets with similar or identical structures, but different cases.Appending: Placing the second dataset below the first dataset (also called stacking).In general, combining datasets takes one of two forms: In many practical situations, you may have relevant data in two different datasets, and in order to perform your analysis, you'll need to combine those datasets. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |