They are not equivalent. The YEARw. (you used YEAR4.) format takes a SAS DATE variable and displays the year-portion. So, your code took the SAS numeric variable value 2009 (which represents the date 19MAY1965) and displayed only the year for that date.
Also, the YEAR() function takes a SAS DATE numeric variable and extracts the year-portion, assigning the value to a variable, as you used it.
The link below provides useful SAS Base DOC reference on this topic.