154k views
4 votes
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?

a) 0
b) 1
c) 12
d) -1

User Sleeper
by
8.3k points

1 Answer

4 votes

Final answer:

In the SAS program, the find function is used to locate 'US' in a case-insensitive manner starting from the 5th position of the string 'Australia, US, Denmark'. The substring 'US' first appears at position 12. Therefore, the value given to Pos by SAS is 12.

Step-by-step explanation:

The SAS program provided contains a function call to find. This function is used to locate a substring within a string. The syntax for the find function is find(source, substring, modifiers, start), where 'source' is the string to search in, 'substring' is the string to find, 'modifiers' affect the search behavior, and 'start' is the position to start the search from.

In the given program, Text = 'Australia, US, Denmark'; Pos = find(Text, 'US', 'i', 5); the 'i' modifier indicates that the search should be case-insensitive, and the search should start at the 5th character of Text. The substring 'US' does first appear at position 12 in the string Text. Therefore, the value that SAS will assign to Pos is 12.

The correct answer to the question is: c) 12.

User Gnosophilon
by
7.9k points

No related questions found