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?
The contents of the raw data file TEAM are listed below:
----|----10---|----20---|----30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. +5 age 2.;
run;
Which one of the following describes the output created?
A. a raw data file only
B. No output is generated as the program fails to execute due to errors.
C. a SAS data set named GROUP only
D. a SAS data set named GROUP and a raw data file
Which one of the following statements is true regarding the SAS automatic _ERROR_ variable?
A. The _ERROR_ variable can be used in expressions or calculations in the DATA step.
B. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
C. The _ERROR_ variable contains the values 'ON' or 'OFF'.
D. The _ERROR_ variable is automatically stored in the resulting SAS data set.
A realtor has two customers. One customer wants to view a list of homes selling for less than
$60,000. The other customer wants to view a list of homes selling for greater than $100,000.
Assuming the PRICE variable is numeric, which one of the following PRINT procedure steps will select all desired observations?
A. proc print data = sasuser.houses; where price lt 60000 and price gt 100000; run;
B. proc print data = sasuser.houses; where price lt 60000 or price gt 100000; run;
C. proc print data = sasuser.houses;
where price lt 60000 or where price gt 100000;
run;
D. proc print data = sasuser.houses;
where price lt 60000; where price gt 100000; run;
data stats;
set revenue;
array weekly{5} mon tue wed thu fri;
<insert DO statement here> total = weekly{i} * .25; output;
end;
run;
Which one of the following DO statements completes the program and processes the elements of the WEEKLY array?
A. do weekly{i} = 1 to 5;
B. do i = 1 to 5;
C. A DO loop cannot be used because the variables referenced do not end in a digit.
D. do i = mon tue wed thu fri;
libname temp 'SAS-data-library';
data work.new;
set temp.jobs;
format newdate mmddyy10.;
qdate = qtr(newdate);
ddate = weekday(newdate);
run;
proc print data = work.new;
run;
The variable NEWDATE contains the SAS date value for April 15, 2000. What output is produced if April 15, 2000 falls on a Saturday?
The SASDATA.BANKS data set has five observations when the following SAS program is submitted:
libname sasdata 'SAS-data-library';
data allobs;
set sasdata.banks;
capital=0;
do year = 2000 to 2020 by 5; capital + ((capital+2000) * rate); output;
end;
run;
How many observations will the ALLOBS data set contain?
Which one of the following is true of the RETAIN statement in a SAS DATA step program?
A. It is only valid in conjunction with a SUM function.
B. It has no effect on variables read with the SET, MERGE and UPDATE statements.
C. It adds the value of an expression to an accumulator variable and ignores missing values.
D. It can be used to assign an initial value to _N_ .
data allobs;
set sasdata.origin (firstobs = 75 obs = 499);
run;
The SAS data set SASDATA.ORIGIN contains 1000 observations. How many observations does the ALLOBS data set contain?
data work.company;
set work.dept1(keep = jobcode) work.dept2(rename = (jcode = jobcode));
run;
Which one of the following is the result?
A. The variable JCODE is written to the output data set.
B. The variable JOBCODE is written to the output data set.
C. The program fails to execute due to errors.
D. Neither variable JCODE nor JOBCODE is written to the output data set.
The following SAS program is submitted:
data work.january;
set work.allmonths (keep = product month num_sold cost);
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep = product sales;
run;
Which variables does the WORK.JANUARY data set contain?
A. PRODUCT and SALES only
B. An incomplete output data set is created due to syntax errors.
C. PRODUCT, MONTH, NUM_SOLD and COST only
D. PRODUCT, SALES, MONTH, NUM_SOLD and COST only
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. FIRST.DEPARTMENT and LAST.DEPARTMENT are variables in the WORK.TOTAL data set.
B. The values of the variable PAYROLL represent the total for each department in the WORK.SALARY data set.
C. The BY statement in the DATA step causes a syntax error.
D. The values of the variable PAYROLL represent a total for all values of WAGERATE in the
WORK.SALARY data set.
Which one of the following is true when SAS encounters a data error in a DATA step?
A. The DATA step stops executing at the point of the error, and the resulting DATA set contains observations up to that point.
B. A note appears in the SAS log that the incorrect data record was saved to a separate SAS file for further examination.
C. The DATA step stops executing at the point of the error, and no SAS data set is created.
D. A note is written to the SAS log explaining the error, and the DATA step continues to execute.
The contents of the raw data file AMOUNT are listed below:
----|----10---|----20---|----30
$1,234
The following SAS program is submitted:
data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description = 'Problems';
else description = 'No Problems';
run;
Which one of the following is the value of the DESCRIPTION variable?
A. No Problems
B. Problems
C. The value can not be determined as the program fails to execute due to errors.
D. ' ' (missing character value)