Question 1:
The answer is (a).
The length of the JOBCATEGORY variable is set as 2. It does not have sufficient length to capture the value 'FA1'. Only the value 'FA' is kept in the variable.
Question 2:
The answer is (b).
When concatenating a character value with a numeric value, the numeric value is automatically converted to character using the (best12.) format.
The value '5461' takes up only four characters. The converted character value will contain eight leading spaces followed by the value '5461'.
The leading spaces are then captured in the combined value in the ITEM_REFERENCE variable.
Question 3:
The answer is (d).
The length of the CITY2 variable is the same as the CITY variable, which is 20.
Question 4:
The answer is (a).
The CATX function combines the first and last name with a single space as the delimiter separating the two names.
Question 5:
The answer is (b). The delimiter is specified as ' ,' which includes a blank space and the comma.
Both the comma and the blank space are used as the delimiter.
The word 'of' is returned since it is the third word from the sentence.
Question 6:
The answer is (d).
The starting position is specified as 5. The first five characters are ignored. SAS finds the text 'US' from position 12 and returns it as the result.
Question 7:
The answer is (d).
The CHAR2 variable extracts the text starting from the third position for four characters.
The text '2345' is extracted into CHAR2.
Question 8:
The answer is (a).
The PHONENUMBER variable is a numeric variable. When using the SUBSTR function on a numeric variable, SAS automatically converts it to character using the (best12.) format.
Two additional blank spaces are added to the value.
The CODE variable will contain ( 3) with two blank spaces before the numeric value (3).
Question 9:
The answer is (d).
The variable created by the SUBSTR function will have the same length as the variable that the value is extracted from.
The value returned by [Substr(First, 1, 7)] will be 16.
The CITY_COUNTRY variable will have a length of 16 + 2 + 7 = 25.
Question 10:
The answer is (d).
The CITY variable contains the value 'Ipswich'. However, it also has a length of 16. SAS automatically added nine trailing spaces to the variable.
The CITY_COUNTRY variable will have spaces added between 'Ipswich' and the comma':
Question 11:
The answer is (c).
The AUTHOR variable contains 15 characters. It has a length of 15.
The variable created by the SCAN function will have the same length as the variable being scanned. The same is true for the SUBSTR function.
As a result, the FIRST variable will have the same length as the AUTHOR variable, which is 15.
**Note: in earlier versions of SAS, the SCAN function returns a variable that has a default length of 200.
The answer for this question used to be (d). However, with the newer version of SAS, this is no longer correct.
Question 12:
The answer is (a).
The SCAN function returns the second word from the AUTHOR variable, which is 'Agatha'.
The SUBSTR function extracts the first character from the text 'Agatha' and it returns the value 'A'.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |