SAS Certified Base Programmer 123 Questions (71)
Which one of the following is true of the RETAIN statement in a SAS DATA step program?
A. It can be used to assign an initial value to _N_ .
B. It is only valid in conjunction with a SUM function.
C. It has no effect on variables read with the SET, MERGE and UPDATE statements.
D. It adds the value of an expression to an accumulator variable and ignores missing values.
SAS Certified Base Programmer 123 Questions (70)
A raw data file is listed below:
----|----10---|----20---|----30 1901 2 1905 1 1910 6 1925 . 1941 1
The following SAS program is submitted and references the raw data file above:
data coins; infile'file-specification'; input year quantity; <insert statement(s) here> run;
Which one of the following completes the program and produces a non-missing value for the variable TOTQUANTITY in the last observation of the output data set?
A.
totquantity + quantity;
B.
totquantity = sum(totquantity + quantity);
C.
totquantity 0;
sum totquantity;
D.
retain totquantity 0;
totquantity = totquantity = quantity;
SAS Certified Base Programmer 123 Questions (69)
A raw data file is listed below:
----|----10---|----20---|----30 squash 1.10 apples 2.25 juice 1.69
The following SAS program is submitted using the raw data file above:
data groceries; infile'file-specification'; input item $ cost; <insert statement(s) here>
Which one of the following completes the program and produces a grand total for all COST values?
A.
grandtot = sum cost;
B.
grandtot = sum(grandtot,cost);
C.
retain grandtot 0;
grandtot = sum(grandtot,cost);
D.
grandtot = sum(grandtot,cost);
output grandtot;
SAS Certified Base Programmer 123 Questions (68)
The following SAS program is submitted:
data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; run;
The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100 observations for each of 5 departments.
Which one of the following represents how many observations the WORK.TOTAL data set contains?
A. 5
B. 20
C. 100
D. 500
SAS Certified Base Programmer 123 Questions (67)
The following SAS program is submitted:
data work.total; set work.salary(keep = department wagerate); by department; if first.department then payroll = 0; payroll + wagerate; if last.department; run;
The SAS data set named WORK.SALARY contains 10 observations for each department, currently ordered by DEPARTMENT.
Which one of the following is true regarding the program above?
A. The BY statement in the DATA step causes a syntax error.
B. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set.
C. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the WORK.SALARY data set.