Which date function returns a number from 1 to 7 representing the day of the week?

Prepare for the SAS Base Programming Certification. Practice with multiple choice questions and receive instant feedback. Strengthen your knowledge and be ready to excel in your exam!

Multiple Choice

Which date function returns a number from 1 to 7 representing the day of the week?

Explanation:
The function that returns a number from 1 to 7 representing the day of the week is WEEKDAY(SAS-date). This function specifically provides the day of the week for a given SAS date, where 1 corresponds to Sunday and 7 corresponds to Saturday. Understanding the context of the other functions helps clarify why WEEKDAY is the correct choice. The QTR function retrieves the quarter of the year (1 to 4) for a given date, making it unsuitable for identifying days of the week. The MONTH function returns the month (1 to 12) for the given SAS date, which again does not relate to the days of the week. Lastly, the YEAR function corresponds to the year of the SAS date and returns a four-digit value representing that year. Hence, WEEKDAY is the only function among the options that specifically offers insight into the day of the week associated with a SAS date.

The function that returns a number from 1 to 7 representing the day of the week is WEEKDAY(SAS-date). This function specifically provides the day of the week for a given SAS date, where 1 corresponds to Sunday and 7 corresponds to Saturday.

Understanding the context of the other functions helps clarify why WEEKDAY is the correct choice. The QTR function retrieves the quarter of the year (1 to 4) for a given date, making it unsuitable for identifying days of the week. The MONTH function returns the month (1 to 12) for the given SAS date, which again does not relate to the days of the week. Lastly, the YEAR function corresponds to the year of the SAS date and returns a four-digit value representing that year.

Hence, WEEKDAY is the only function among the options that specifically offers insight into the day of the week associated with a SAS date.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy