I'm new to sas and would like learn to calculate:
How many days in the first week of the year?
For example:
Year = 2016, Week = 1
num_days: 2 days
Year = 2020, week = 1
num_days: 4 days
Hello @alo_moon and welcome to the SAS Support Communities!
You can use the WEEKDAY function (together with the MDY function and a simple calculation) to get the desired result:
data want; input year; num_days=8-weekday(mdy(1,1,year)); cards; 2016 2020 ;
View solution in original post
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.