Exam A00-211 All QuestionsBrowse all questions from this exam
Question 24

The following SAS program is submitted:

data WORK.ONE;

Text=Australia, US, Denmark;

Pos=find(Text,US,i,5);

run;

What value will SAS assign to Pos?

    Correct Answer: A

    The FIND function in SAS searches for a substring (here 'US') within a string (here 'Australia, US, Denmark') starting from a specified position. In this code, the position is set to 5, which starts searching from the character position 5 within the 'Text' string. However, positions in SAS strings start at the first character being position 1. So, the search starts from the character 'r' of 'Australia'. Since 'US' does not appear after position 5 within the given text 'Australia, US, Denmark', the FIND function returns 0, indicating the substring was not found within the specified constraints.

Discussion
MTKV18Option: D

data ONE_1; Text="Australia, US, Denmark"; Pos=find(Text,'US','i',5); put Pos=; run; Correct code