SAS Chapter 10 Worksheet

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

If you merge data sets Sales.Reps, Sales.Close, and Sales.Bonus by ID, what is the value of Bonus in the third observation in the new data set? (See Word) Missing $4,000 $3,000 can't tell from the information given

$4,000

If you run this DATA step, what observations does the data set bonuses contain? data bonuses; merge managers (in=M) staff (in=S); by EmpID; if M=0 and S=1; run; A.)all of the observations from managers, and only those observations from staff with matching values for EmpID B.)all observations from staff and all observations from managers, whether or not they have matching values C.)all of the observations from staff, and only those observations from managers with matching valuesfor EmpID D.)only those observations from staff and managerswith matching values for EmpID

B.)all observations from staff and all observations from managers, whether or not they have matching values

in the second iteration of this data set, after the data is merged, what are the values of C and A?

C = 1, A = 1

In the second iteration of this DATA step, after the data is merged, what are the values of C and A? (See Word) data client_amount; merge clients(in=C) amounts(in=A); by Name; run; C=1, A=1 missing C=0, A=1 C=1, A=0

C=1, A=1

What happens if you submit the following program to merge Blood.Donors1 and Blood.Donors2, shown below? (See Word) data work.merged; merge blood.donors1 blood.donors2; by id; run; A.)The Merged data set contains 8 observations. B.)Values for Units in Blood.Donors2 overwrite values for Units in Blood.Donors1. C.)The Merged data set contains some missing values because not all observations have matching observations in the other data set. D.)The DATA step produces errors.

D.) The DATA step produces errors.

suppose you merge data sets health.set1 and health.set2 below. (See Word) data work.merged; merge health.set1(in=in1) health.set2(in=in2); by id; if in1 and in2; run; proc print data=work.merged; run;

Should have 7 observations

What happens if you merge the following data sets by variable SSN? (See Word) The values of Age in the 2nd data set overwrite the values of Age from the 1st data set. The values of Age in the 2nd data set are set to missing. The values of Age in the 1st data set overwrite the values of Age from the 2nd data set. The DATA step fails because the two data sets contain same-named variables that have different values.

The values of Age in the 2nd data set overwrite the values of Age from the 1st data set.

what is the syntax error in this data step? data returns_qrt1; set returns_jan(rename=(ID=CustID) (Return=Item)) returns_feb(rename=(Dt=Date)) returns_mar; run; You cannot specify more than two data sets in the set statement. You cannot specify multiple variables in the RENAME=option There are too many sets of parentheses in the RENAME=option The BY statement is missing

There are too many sets of parentheses in the rename = option

Which of the following statements is true about merging SAS data sets by using the DATA step? To match-merge data sets, all input data setsmust be sorted or indexed on the BY variableor variables. all of the above Match-merging is merging by values of one or more common variables. SAS can merge data sets based on the positionof observations in the original data set or by the values of one or more common variables. Merging combines observations from two or more data sets into a single observation in a new data set.

all of the above

Which program will combine Actors.Props1 and Actors.Props2 to produce Actors.Props3? (See Word) data actors.props3; merge actors.props1 actors.props2; by actor; run; data actors.props3; set actors.props1 actors.props2; run; data actors.props3; set actors.props1; set actors.props2; run; data actors.props3; set actors.props1 actors.props2; by actor; run;

data actors.props3; set actors.props1 actors.props2; by actor; run;

The data sets Ensemble.Spring and Ensemble.Summer both contain a variable named Blue. How do you prevent the values of the variable Blue from being overwritten when you merge the two data sets? data ensemble.merged; merge ensemble.spring(rename=(blue=navy)) ensemble.summer; by fabric; run; data ensemble.merged; merge ensemble.spring(out=blue) ensemble.summer; by fabric; run; data ensemble.merged; merge ensemble.spring(blue=navy) ensemble.summer; by fabric; run; data ensemble.merged; merge ensemble.spring(in=blue) ensemble.summer; by fabric; run;

data ensemble.merged; merge ensemble.spring(rename=(blue=navy)) ensemble.summer; by fabric; run;

Which of the following programs concatenates the data sets sales and products, in that order? data newsales; set sales products; run; data newsales; set sales; set products; run; data newsales; set products sales; run;

data newsales; set sales products; run;

Suppose you want to concatenate these data sets. Which DATA step creates an output data set that combines the values of Color and Hue in the single variable Color?(See Word) data widgets_all; set widget1 widget2(Hue=Color); run; data widgets_all; set widget1 widget2(rename=(Hue=Color)); run; data widgets_all; set widget1 (rename=(Hue=Color)) widget2; run;

data widgets_all; set widget1 widget2(rename=(Hue=Color)); run

If you concatenate the data sets below in the order shown, what is the value of Sale in observation 2 of the new data set? $40,000 You cannot concatenate these data sets. Missing $30,000

missing

If you concatenate the data sets below in the order shown, what is the value of Sale in observation 2 of the new data set? (See Word) $40,000. $30,000 You cannot concatenate these data sets. missing

missing

What is the relationship of the data set first to the data set second when merged by the variable ID? (See Word) many-to-many nonmatching one-to-one many-to-one one-to-many

one to one

If you run this DATA step, what observations does the data set bonuses contain? data bonuses; merge managers (in=M) staff (in=S); by EmpID; if M=0 and S=1; run; no observations only the observations from managers �that have no match in staff all observations from both managers and staff, whether or not they match only the observations from staff �that have no match in managers

only the observations from staff �that have no match in managers


Set pelajaran terkait

Chapter 41: Stress, Coping and Adaptation

View Set

Western Civilization Chapters 13-17

View Set

Ch. 5: Functions and One-to-One and Onto

View Set