Loading...
https://basesasonlinetraining.blogspot.com/2015/07/base-sas-faqs.html
1. The SAS data
set EMPLOYEE_INFO is listed below:
IDNumber
Expenses
2542
100.00
3612
133.15
2198
234.34
2198
111.12
The
following SAS program is submitted:
proc
sort data = employee_info;
run;
Which one of the
following BY statements completes the program and sorts the data sequentially
by ascending expense values within each ascending IDNUMBER value?
A.
by Expenses IDNumber;
B.
by IDNumber Expenses;
C.
by ascending (IDNumber Expenses);
D.
by ascending IDNumber ascending Expenses;
Ans : B. By default
SAS will sort data in ascending order. IDNumber should be specified before
Expenses as we want IDNUMBER to be sorted in ascending.
2. Which one of
the following is true of the SUM statement in a SAS DATA step program?
A.
It is only valid in conjunction with a SUM function.
B.
It is not valid 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 does not retain the accumulator variable value from one iteration of the SAS
DATA step to the next.
Ans : C
3. Which of the
following is a valid statement about the VALUE range in the PROC FORMAT
procedure? It cannot be...
A.
A single character or numeric value
B.
A range of character values
C.
A list of unique values separated by commas
D.
A combination of character and numeric values
Ans : D
4. The following
SAS program is submitted:
data
work.one;
x
= 3;
y
= 2;
z
= x ** y;
run;
Which one of the
following is the value of the variable Z in the output data set?
A.
6
B.
9
C.
. (missing numeric value)
D.
The program fails to execute due to errors.
Ans : B
**
= exponentiation
X**Y
raise X to the power of Y
So
3 to the power of 2 = 9
5. Which of the
following is not an error identified during the compilation phase?
A)
Quotation marks are unbalances
B)
No RUN statement in the step
C)
An option is invalid
D)
Semicolons are missing in statements
Ans : B
6. Which one of
the following SAS statements renames two variables?
A.
set work.dept1 work.dept2(rename = (jcode = jobcode) (sal = salary));
B.
set work.dept1 work.dept2(rename = (jcode = jobcode sal = salary));
C.
set work.dept1 work.dept2(rename = jcode = jobcode sal = salary);
D.
set work.dept1 work.dept2(rename = (jcode jobcode) (sal salary));
Ans : B. The syntax for RENAME is as follows :
RENAME=(old-name-1=new-name-1
old-name-2=new-name-2. . . old-name-n=new-name-n)
7. How many of
the following variable names will not produce errors in an assignment
statement?
variable
var
1variable
var1
#var
_variable#
A.
0
B.
1
C.
3
D.
6
Ans : C ; variable
var var1. A variable cannot start with numeric or special characters except _.
You also cannot use special characters anywhere in the name either though
numeric values are allowed.
8.
The following SAS program is submitted:
data test;
set sasuser.employees;
if 2 le years_service le 10 then
amount = 1000;
else if years_service gt 10 then
amount = 2000;
else
amount = 0;
amount_per_year = years_service /
amount;
run;
Which one of the following values does
the variable AMOUNT_PER_YEAR contain if an employee has been with the company
for one year?
A. 0
B. 1000
C. 2000
D. . (missing numeric value)
Ans
:
D (missing). It returns missing value as amount will be 0.
SAS
Log:
NOTE: Mathematical operations could
not be performed at the following places. The results of the operations have
been set to missing values.
9.
The following SAS program is submitted:
libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists (keep = job_code);
if job_code = 'chem3'
then description = 'Senior Chemist';
run;
The variable JOB_CODE is a character
variable with a length of 6 bytes.
Which
one of the following is the length of the variable DESCRIPTION in the output
data set?
A. 6 bytes
B. 8 bytes
C. 14 bytes
D. 200 bytes
Ans : C. The length
of 'Senior Chemist' is 14.
10.
Which one of the following statements is true regarding the name of a SAS
array?
A. It is saved with the data set.
B. It can be used in procedures.
C. It exists only for the duration of
the DATA step.
D. It can be the same as the name of a
variable in the data set.
Ans
:
C.
VirtualNuggets
2356947166836819424
Post a Comment
Home
item
Blog Archive
Popular Posts
-
Base SAS software contains the following: A data management facility A programming language Data analysis and reporting utilities ...
-
1. The SAS data set EMPLOYEE_INFO is listed below: IDNumber Expenses 2542 100.00 3612 133.15 2198 234.34 2198 111.12 The...
-
In this blog post, we'll get to know the use of iterative DO loops, in which you tell SAS to carry out a statement or a group of state...
-
Informats are typically used to read or input data from external files called flat files (text files, ASCII files, or sequential files...
-
1.)The following SAS program is submitted: data work.new; length word $7; amount = 7; if amount = 5 then word = 'CAT';...
-
One can subset dataset using IF or WHERE statement to select specific observations from existing SAS data sets in order to create a new...
-
Elements of the SAS Language The statements that formed the data set WEIGHT_CLUB are part of the SAS programming language. The SAS...