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
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Register now!
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.