Introduction

Welcome to Edition 19 of Making SAS Accessible to Everyone. This edition is the second quiz in our review series. It focuses on key topics covered in Editions 9 to 13, including:

  • SQL processing in SAS
  • Controlling the DATA step
  • Summarizing data
  • Data manipulation using functions
  • Custom formats

This quiz includes 20 questions (multiple-choice and true/false), designed to reinforce your knowledge and sharpen your SAS skills.


1. Multiple Choice Questions

Q1. Which SQL clause is used to group data in PROC SQL?

A. SELECT
B. ORDER BY
C. GROUP BY
D. CLASS

Q2. What does the HAVING clause do in PROC SQL?

A. Filters individual rows before aggregation
B. Filters groups after aggregation
C. Sorts the data
D. Merges tables

Q3. In PROC SQL, which keyword is used to remove duplicate rows?

A. NOREPEAT
B. DISTINCT
C. UNIQUE
D. CLEAN

Q4. Which statement is used to stop DATA step processing prematurely?

A. END
B. LEAVE
C. STOP
D. EXIT

Q5. What is the purpose of the RETain statement?

A. Reset values every iteration
B. Delete variables from memory
C. Keep values between iterations
D. Create new variables

Q6. Which function would you use to round values to the nearest whole number?

A. FLOOR()
B. ROUND()
C. CEIL()
D. INT()

Q7. Which function finds the position of a substring in a string?

A. POSITION()
B. SUBSTR()
C. FIND()
D. INDEX()

Q8. What does the CALL SYMPUT function do?

A. Reads macro values into a DATA step
B. Executes system commands
C. Creates macro variables from DATA step values
D. Clears memory

Q9. In PROC FORMAT, which statement defines a custom format?

A. FORMAT
B. VALUE
C. LABEL
D. MAP

Q10. Which format category would you define for numeric codes representing labels?

A. $FORMAT
B. CFORMAT
C. VALUE
D. PICTURE


2. True or False Questions

Q11. PROC SQL can be used to join multiple tables in SAS.

True / False

Q12. The STOP statement causes SAS to skip the current observation.

True / False

Q13. You can use LENGTH to control how character values are stored.

True / False

Q14. SUM() ignores missing values when calculating totals.

True / False

Q15. CATX() joins strings using a delimiter.

True / False

Q16. Custom formats defined in PROC FORMAT must be applied using a FORMAT statement.

True / False

Q17. FLOOR() returns the smallest integer greater than or equal to the argument.

True / False

Q18. You can apply a custom format directly in PROC SQL.

True / False

Q19. A RETAIN statement is used to assign a default value to a variable.

True / False

Q20. CALL SYMPUT can be used to pass summary statistics into macro variables.

True / False


Answers & Explanations

Q1. C. GROUP BY – Used to create grouped summaries.

Q2. B. Filters groups after aggregationHAVING works like WHERE but for groups.

Q3. B. DISTINCT – Ensures only unique rows are selected.

Q4. C. STOP – Ends processing of the DATA step.

Q5. C. Keep values between iterations – Prevents reinitialization of variables.

Q6. B. ROUND() – Rounds numeric values.

Q7. D. INDEX() – Locates position of a substring.

Q8. C. Creates macro variables from DATA step values – Transfers values to macro scope.

Q9. B. VALUE – Used in PROC FORMAT to define format mappings.

Q10. C. VALUE – For numeric formats mapping codes to labels.

Q11. TruePROC SQL supports joins (INNER, LEFT, etc.).

Q12. FalseSTOP ends the entire DATA step.

Q13. True – Controls storage space and max character size.

Q14. True – Ignores missing values.

Q15. True – Concatenates strings with delimiter.

Q16. True – Must use FORMAT to apply custom format.

Q17. FalseFLOOR() returns the greatest integer less than or equal.

Q18. True – Custom formats can be applied in SQL SELECT.

Q19. False – It keeps the value, not sets the default.

Q20. True – Often used to pass means or other summaries from PROC MEANS.


In Edition 20, we’ll wrap up this series of quizzes with questions based on Editions 14 through 17.

Keep practicing and progressing with 3 D Statistical Learning!