viernes, 3 de febrero de 2017

Examen ejemplo certificación SAS "Base Programmer" (I)

Añadimos un ejemplo de examen de la certificación: 'SAS Certified Base Programmer for SAS 9'

Información general del examen


Examen de ejemplo:

Question 1
The following program is submitted.
data WORK.TEST;
  input Name $ Age;
datalines;
John +35
;
run;
Which values are stored in the output data set?
  1. Name              Age
    ---------------------
    John               35 
  2. Name              Age
    ---------------------
    John              (missing value)
  3. Name              Age
    ---------------------
    (missing value)   (missing value)
  4. The DATA step fails execution due to data errors.
correct_answer = "A"
Question 2
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?
  1. Id  Char1  Char2
    ---  -----  -----
    182  M
    
  2. Id  Char1  Char2
    ---  -----  -----
    182         Q
    
  3. Id  Char1  Char2
    ---  -----  -----
    182  M      Q
    
  4. Id  Char1  Char2
    ---  -----  -----
    720  P      S
    
correct_answer = "C"
Question 3
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?
  1. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   RED     ORANGE
    BLUE     INDIGO   BLUE    INDIGO
    CYAN     WHITE    CYAN    WHITE
    GRAY     BROWN    GRAY    BROWN
    
  2. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   BLUE    INDIGO
    CYAN     WHITE    GRAY    BROWN
    
  3. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
    
  4. Var1     Var2     Var3    Var4
    ------   ------   ------  ------
    RED      ORANGE   YELLOW  GREEN
    BLUE     INDIGO   PURPLE  VIOLET
    CYAN     WHITE    FUCSIA  BLACK
    GRAY     BROWN    PINK    MAGENTA
    
correct_answer = "A"
Question 4
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?

Enter your numeric answer in the space below.


correct_answer = "8"
Question 5
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?
  1. X = 3, Index = 5
  2. X = 5, Index = 5
  3. X = 5, Index = 6
  4. X = 5, Index = 7
correct_answer = "D"
Question 6
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?
  1. proc print data = SASUSER.CLASS;
       var test;
       format test score;
    run;
    
  2. proc print data = SASUSER.CLASS;
       var test;
       format test score.;
    run;
    
  3. proc print data = SASUSER.CLASS format = score;
       var test;
    run;
    
  4. proc print data = SASUSER.CLASS format = score.;
       var test;  
    run;
    
correct_answer = "B"
Question 7
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?
  1. keep Total;
  2. retain Total 0;
  3. Total = 0;
  4. If _N_= 1 then Total = 0;
correct_answer = "B"
Question 8
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
  1. Qtr1 = sum(of month{_ALL_});
  2. Qtr1 = month{1} + month{2} + month{3};
  3. Qtr1 = sum(of month{*});
  4. Qtr1 = sum(of month{3});
correct_answer = "C"
Question 9
Given the following SAS error log
  44   data WORK.OUTPUT;
  45     set SASHELP.CLASS;
  46     BMI=(Weight*703)/Height**2;
  47     where bmi ge 20;
  ERROR: Variable bmi is not on file SASHELP.CLASS.
  48   run;
What change to the program will correct the error?
  1. Replace the WHERE statement with an IF statement
  2. Change the ** in the BMI formula to a single *
  3. Change bmi to BMI in the WHERE statement
  4. Add a (Keep=BMI) option to the SET statement
correct_answer = "A"
Question 10
The following SAS program is submitted:
data WORK.TEMP;
  Char1='0123456789';
  Char2=substr(Char1,3,4);
run;
What is the value of Char2?
  1. 23
  2. 34
  3. 345
  4. 2345
correct_answer = "D"

Más ejemplos de examen (parte II)

Formación SAS

No hay comentarios:

Publicar un comentario