Which of the following statements is true about merging SAS data sets by using t
ID: 2928765 • Letter: W
Question
Which of the following statements is true about merging SAS data sets by using the DATA step?
a. Merging combines observations from two or more data sets into a single observation in a new data set.
b. SAS can merge data sets based on the position of observation s in the original data set or by the values of one or more common variables.
c. Match-merging is merging by values of one or more common variables.
d. To match-merge data sets, all input data sets must be sorted or indexed on the BY variable or variables.
e. all of the above
Explanation / Answer
Sol:
ANSWER E
Joins/Combines observations from two or more SAS Datasets into single
observation in new Dataset.
-> Merge usually joins Datasets with different variables.
-> Output Dataset contains all the variables from all Datasets.
-> Upto 100 Datasets can merge in one step.
-> Observations are joining one to one with out BY statement
-> Observations are Match Merge with BY statement.
a. Merging combines observations from two or more data sets into a single observation in a new data set.
ds a
id marks
1 25
dsB
id marks
1 26
ds C
id marks
1 26
Sttement a is correct
b. SAS can merge data sets based on the position of observation s in the original data set or by the values of one or more common variables.
The number of observations in the new dataset is equal to the largest number of
observations in each BY group from original Datasets.
Before performing match Merge all Datasets must be sorted based on common variables.
To perform match Merge we can use the MERGE statement with BY statement.
In the SAS match-merge, the matching process is controlled by the BY variables. BY
variables are the variables listed in the BY statement.
BY variables should be key variables. Key variables are either character or numeric
variables that uniquely identify or label the records or observations within the input
datasets.
Syntax:-
Merge Dataset(s);
By variable(s);
Option B ,C are also correct.
d. To match-merge data sets, all input data sets must be sorted or indexed on the BY variable or variables.
Proc sort data=ds1;
By id;
Run;
Proc sort data=ds2;
By id;
Run;
Data ds3;
Merge ds1 ds2;
By id;
Run;
ANSWER :
e)ALL OF THE ABOVE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.