Sunday, 5 June 2016

BASE SAS : Interview Questions (Written Exams)

QUESTION 1
The following SAS program is submitted:
data one;
addressl = ‘214 London Way’;
run;
data one;
set one;
address = tranwrd(address1, ‘Way’, ‘Drive’);
run;
What are the length and value of the variable ADDRESS?
Options:
A.    Length is 14; value is ‘214 London Dri’.
B.    Length is 14; value is ‘214 London Way’.
C.    Length is 16; value is ‘214 London Drive’.
D.   Length is 200; value is ‘214 London Drive’.
QUESTION 2
The following program is submitted.
data WORK.TEST;
  input Name $ Age;
datalines;
John +35
;
run;
Which values are stored in the output data set?
Options:
A.    Name              Age
---------------------
John               35
B.    Name              Age
---------------------
John              (missing value)
C.    Name              Age
---------------------
(missing value)   (missing value)
  1. The DATA step fails execution due to data errors.
QUESTION 3
Given the SAS data set WORK.ONE:
Id  Char1
---  -----
182  M
190  N
250  O
720  P
and the SAS data set WORK.TWO:
 Id  Char2
---  -----
182  Q
623  R
720  S
The following program is submitted:
data WORK.BOTH;
   merge WORK.ONE WORK.TWO;
   by Id;
run;
What is the first observation in the SAS data set WORK.BOTH?
Options:
  1. A. Id  Char1  Char2
---  -----  -----
182  M

  1. B. Id  Char1  Char2
---  -----  -----
182         Q

  1. C. Id  Char1  Char2
---  -----  -----
182  M      Q

  1. D. Id  Char1  Char2
---  -----  -----
720  P      S

QUESTION 4
Which program displays a listing of all data sets in the SASUSER library?
Options:
A.    proc contents lib = sasuser.all; run;
B.    proc contents data = sasuser.all; run;
C.    proc contents lib = sasuser._alI_; run;
D.   proc contents data = sasuser._all_; run;

QUESTION 5
The following SAS program is submitted:
proc format;
  value score  1  - 50  = 'Fail'
              51 - 100  = 'Pass';
run;
Which one of the following PRINT procedure steps correctly applies the format?
Options:
A.    proc print data = SASUSER.CLASS;
   var test;
   format test score;
run;
 B.    proc print data = SASUSER.CLASS;
   var test;
   format test score.;
run;
C.    proc print data = SASUSER.CLASS format = score;
   var test;
run;
D.   proc print data = SASUSER.CLASS format = score.;
   var test; 
run;

QUESTION 6
 Given the text file COLORS.TXT:
----+----1----+----2----+----
RED    ORANGE  YELLOW  GREEN
BLUE   INDIGO  PURPLE  VIOLET
CYAN   WHITE   FUCSIA  BLACK
GRAY   BROWN   PINK    MAGENTA
The following SAS program is submitted:
data WORK.COLORS;
  infile 'COLORS.TXT';
  input @1 Var1 $ @8 Var2 $ @;
  input @1 Var3 $ @8 Var4 $ @;
run;
What will the data set WORK.COLORS contain?
Options:
A.    Var1     Var2     Var3    Var4
------   ------   ------  ------
RED      ORANGE   RED     ORANGE
BLUE     INDIGO   BLUE    INDIGO
CYAN     WHITE    CYAN    WHITE
GRAY     BROWN    GRAY    BROWN

B.    Var1     Var2     Var3    Var4
------   ------   ------  ------
RED      ORANGE   BLUE    INDIGO
CYAN     WHITE    GRAY    BROWN

C.    Var1     Var2     Var3    Var4
------   ------   ------  ------
RED      ORANGE   YELLOW  GREEN
BLUE     INDIGO   PURPLE  VIOLET

D.   Var1     Var2     Var3    Var4
------   ------   ------  ------
RED      ORANGE   YELLOW  GREEN
BLUE     INDIGO   PURPLE  VIOLET
CYAN     WHITE    FUCSIA  BLACK
GRAY     BROWN    PINK    MAGENTA

QUESTION 7
The following SAS program is submitted:
data work.accounting;
set work.dept1 work.dept2;
jobcode = ‘FA1’;
length jobcode $ 8;
run;
A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set. What is the length of the variable JOBCODE in the output data set?
Options:
A.    3
B.    5
C.    7
D.   8

QUESTION 8
Given the SAS data set WORK.INPUT:
Var1     Var2
------   -------
A        one
A        two
B        three
C        four
A        five
The following SAS program is submitted:
data WORK.ONE WORK.TWO;
  set WORK.INPUT;
  if Var1='A' then output WORK.ONE;
  output;
run;
How many observations will be in data set WORK.ONE? 
Options: 
A.    8
B.    7
C.    9 
D.   5

QUESTION 9
Given the following SAS error log
data WORK.OUTPUT;
   set SASHELP.CLASS;
   BMI=(Weight*703)/Height**2;
   where bmi ge 20;
   ERROR: Variable bmi is not on file SASHELP.CLASS.
run;
What change to the program will correct the error?
Options:
  1. A. Replace the WHERE statement with an IF statement
  2. B. Change the ** in the BMI formula to a single *
  3. C. Change bmi to BMI in the WHERE statement
  4. D. Add a (Keep=BMI) option to the SET statement

QUESTION 10
The following SAS program is submitted:
footnote1 ‘Sales Report for Last Month’;
footnote2 ‘Selected Products Only’;
footnote3 ‘All Regions’;
footnote4 ‘All Figures in Thousands of Dollars’;
proc print data = sasuser.shoes;
footnote2 ‘All Products’;
run;
Which footnote(s) is/are displayed in the report?
Options:
A.    All Products
B.    Sales Report for Last Month All Products
C.    All Products All Regions All Figures in Thousands of Dollars
D.   Sales Report for Last Month All Products All Regions All Figures in Thousands of Dollars

QUESTION 11
The following SAS program is submitted:
data WORK.LOOP;
  X = 0;
  do Index = 1 to 5  by  2;
    X = Index;
  end;
run;
Upon completion of execution, what are the values of the variables X and Index in the SAS data set named WORK.LOOP?
Options:
  1. A. X = 3, Index = 5
  2. B. X = 5, Index = 5
  3. C. X = 5, Index = 6
  4. D. X = 5, Index = 7

QUESTION 12
This item will ask you to provide a line of missing code; 
The SAS data set WORK.INPUT contains 10 observations, and includes the numeric variable Cost. 
The following SAS program is submitted to accumulate the total value of Cost for the 10 observations:
data WORK.TOTAL;
  set WORK.INPUT;
  <insert code here>
  Total=Total+Cost;
run;
Which statement correctly completes the program?
Options:
  1. A. keep Total;
  2. B. retain Total 0;
  3. C. Total = 0;
  4. D. If _N_= 1 then Total = 0;

QUESTION 13
Given the raw data record DEPT:
----|----10---|----20---|----30
Printing 750
The following SAS program is submitted:
data bonus;
infile ‘dept’;
input dept$ 1-11 number 13- 15;
<insert statement here>
run;
Which SAS statement completes the program and results in a value of ‘Printing750’ for the DEPARTMENT variable?
Options:
A.    department = dept || number;
B.    department = left(dept) || number;
C.    department = trim(dept) number;
D.   department=trim(dept)||put(number,3.);

QUESTION 14
This question will ask you to provide a line of missing code. 
Given the following data set WORK.SALES:
SalesID  SalesJan  FebSales  MarchAmt
-------  --------  --------  --------
W6790          50       400       350
W7693          25       100       125
W1387           .       300       250
The following SAS program is submitted:
data WORK.QTR1;
   set WORK.SALES;
   array month{3} SalesJan FebSales MarchAmt;
   <insert code here>
run;
Which statement should be inserted to produce the following output?
SalesID  SalesJan  FebSales  MarchAmt  Qtr1
-------  --------  --------  --------  ----
W6790          50       400       350   800
W7693          25       100       125   250
W1387           .       300       250   550

Options:
A.    Qtr1 = sum(of month{_ALL_});
B.    Qtr1 = month{1} + month{2} + month{3};
C.    Qtr1 = sum(of month{*});
D.   Qtr1 = sum(of month{3});

QUESTION 15
The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of “Asking Price”. Which SAS program temporarily replaces the label “Asking Price” with the label “Sale Price” in the output?
Options:
A.    proc print data = sasuser.houses; label price = “Sale Price”; run;
B.    proc print data = sasuser.houses label; label price “Sale Price”; run;
C.    proc print data = sasuser.houses label; label price = “Sale Price”; run;
D.   proc print data = sasuser.houses; price = “Sale Price”; run;

QUESTION 16
The following SAS program is submitted:
data WORK.TEMP;
  Char1='0123456789';
  Char2=substr(Char1,3,4);
run;
What is the value of Char2?
Options:
A.    23
B.    34
C.    345
D.   2345 

QUESTION 17
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are shown below:
WORK.EMPLOYEE WORK.SALARY
fname age name salary
Bruce 30 Bruce 25000
Dan 40 Bruce 35000
Dan 25000
The following SAS program is submitted:
data work.empdata;
by fname;
totsal + salary;
run;
Which one of the following statements completes the merge of the two data sets by the FNAME variable?
Options:
A.    merge work.employee
work.salary (fname = name);
B.    merge work.employee
work.salary (name = fname);
C.    merge work.employee
work.salary (rename = (fname = name));
D.   merge work.employee
work.salary (rename = (name = fname));

QUESTION 18
The following SAS program is submitted:
data work.sets;
do until (prod gt 6);
prod + 1;
end;
run;
What is the value of the variable PROD in the output data set?
Options:
A.    6
B.    7
C.    8
D.   (missing numeric)

No comments:

Post a Comment