Statistical Analysis System (SAS) Programming Certification Practice Exam

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the SAS Programming Certification Exam with a variety of questions and detailed explanations. Enhance your SAS skills and increase your confidence. Get ready for success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which option creates a subset of the data where the Finish variable contains the string walnut in a case-insensitive manner?

  1. if index(finish,walnut) = 0;

  2. if index(finish,'walnut') > 0;

  3. if index(lowcase(finish),walnut) = 0;

  4. if index(lowcase(finish),'walnut') > 0;

The correct answer is: if index(lowcase(finish),'walnut') > 0;

The correct option creates a subset of the data by leveraging functions that allow for case-insensitivity when searching for the string "walnut" within the Finish variable. Specifically, the use of the `lowcase` function converts the contents of the Finish variable to lowercase, which enables a straightforward comparison against a lowercase string representation of "walnut." By applying `lowcase(finish)`, the function standardizes the case of the Finish variable, thereby ensuring that any variation of "walnut" (such as "Walnut", "WALNUT", etc.) will match successfully, as they will all be converted to "walnut" for the comparison. The `index` function then checks if "walnut" exists within this modified string. A result greater than 0 indicates the substring is present, effectively filtering the data to only those entries that contain "walnut," regardless of their original casing. This method is robust in its case-insensitivity and thus accurately fulfills the requirement stated in the question.