Exercises and Projects for The Little SAS Book, Sixth Edition. Lora D. Delwiche

Чтение книги онлайн.

Читать онлайн книгу Exercises and Projects for The Little SAS Book, Sixth Edition - Lora D. Delwiche страница 10

Автор:
Жанр:
Серия:
Издательство:
Exercises and Projects for The Little SAS Book, Sixth Edition - Lora D. Delwiche

Скачать книгу

function can be used to replace text?

      a. TRIM

      b. INDEX

      c. TRANWRD

      d. PROPCASE

      7. Which of the following is a valid function for finding the average of X1, X2, and X3?

      a. AVERAGE(X1,X2,X3)

      b. AVG(X1,X2,X3)

      c. MEAN(X1,X2,X3)

      d. MU(X1,X2,X3)

      8. What will SAS return for the value of X?

      X = MIN(SUM(1,2,3),56/8,N(8));

      a. 1

      b. 6

      c. 8

      d. .

      9. Which of the following IF-THEN statements will not assign a value of 1 to the variable named Flag for patients with an eye color of blue or brown?

      a. IF EyeColor = ‘blue’ OR ‘brown’ THEN Flag = 1;

      b. IF EyeColor = ‘blue’ OR EyeColor = ‘brown’ THEN Flag = 1;

      c. IF EyeColor IN (‘blue’,’brown’) THEN Flag = 1;

      d. All of the above will work

      10. Which set of IF-THEN/ELSE statements will run without errors?

      a. IF 0 <= Age <= 50 THEN Group = ‘A’;

       ELSE 50 < Age <=70 THEN Group = ‘B’;

       ELSE Age > 70 THEN Group = ‘C’;

      b. IF 0 <= Age <= 50 THEN Group = ‘A’;

       ELSE IF 50 < Age <= 70 THEN Group = ‘B’;

       ELSE Age > 70 THEN Group = ‘C’;

      c. IF 0 <= Age <= 50 THEN Group = ‘A’;

       ELSE IF 50 < Age <= 70 THEN Group = ‘B’;

       ELSE IF Age > 70 THEN Group = ‘C’;

      d. All of the above will work

      11. Given the following raw data and program, how many observations will be in the resulting SAS data set?

      ----+----1----+----2

      41 25 male

      32 79 female

      36 52 female

      74 63 male

      DATA pts;

      INFILE ‘c:\MyRawData\Measures.dat’;

      INPUT ID Age Gender $;

      IF Age < 75;

      IF Age < 50 AND Gender = ‘female’ THEN

      Guideline = ‘Inv4a’;

      ELSE IF Age >= 50 AND Gender = ‘female’ THEN

      Guideline = ‘Inv4b’;

      ELSE Guideline = ‘n/a’;

      RUN;

      a. 1

      b. 2

      c. 3

      d. 4

      12. How many clauses are in the following SQL step?

      PROC SQL;

      SELECT Name, Address, Phone, Email

      FROM contacts;

      QUIT;

      a. 1

      b. 2

      c. 3

      d. 4

      13. When creating a table using PROC SQL, which of the following clauses would select only rows that have a value greater than 10 for the column called Age?

      a. WHERE Age > 10

      b. IF Age > 10

      c. SELECT Age > 10

      d. None of the above

      14. Given the following program and SAS data set ANIMALS, what will be the value of the variable DogYears for the second observation in the resulting SAS data set called DOGS?

      ANIMALS

NameTypeBreedAge
MinaCanineGerman Shepherd5
BaileyFelineNorwegian Forest9
SammyCanineShetland Sheepdog10
TacoCanineTerrier14

      DATA dogs;

      SET animals;

      DogYears = Age * 7;

      IF Type = ‘Canine’ THEN OUTPUT;

      RUN;

      a. .

      b. 35

      c. 63

      d. 70

      15. How many observations will be produced with the following program?

      DATA new;

      DO p = 1 TO 5;

      OUTPUT;

      END;

      RUN;

      a. 0

      b. 1

      c. 5

      d. 6

      16. Suppose that the YEARCUTOFF= option is set to 1950, and your raw data file has the following date that is read using the MMDDYY8. informat and then printed using the MMDDYY10. format. How would the resulting date appear in the output?

      ----+----1----+----2

      01/01/1920

      a. 01/01/1920

      b. 01/01/1919

      c. 01/01/2019

      d. 01/01/2020

      17. What is the SAS date value that corresponds to December 25, 1959?

Скачать книгу