Help the intern!
I have imported dates when our company has received applications from excel into sas. The dates read as ddmonyyyy in SAS and i'm looking to find how many applications we received since 01jun2016 week by week afterwards. Any ideas on how to do this?
libname DESE 'C:\Users\Documents\DESE';
proc import out = DESE.datesreceived
datafile = 'C:\Users\Documents\DESE\DatesReceived.xlsx'
DBMS = xlsx replace;
sheet = 'Sheet1';
getnames = yes;
run;
proc freq data = dese.datesreceived;
table date_received;
run;
Apply a week format, untested, you can look up the appropriate format for your needs. To filter after a specified date add a where.
proc freq data = dese.datesreceived;
where date_received > '01Jun2016'd;
table date_received;
format date_received week.;
run;
Apply a week format, untested, you can look up the appropriate format for your needs. To filter after a specified date add a where.
proc freq data = dese.datesreceived;
where date_received > '01Jun2016'd;
table date_received;
format date_received week.;
run;
i'm getting a "ERROR: The format WEEK was not found or could not be loaded" when trying your solution. do you know what could be the problem?
There are three different week formats that may be of Interest WeekU, WeekV and WeekW. Each uses a slightly different count method based on the start of the week and year
WeekU uses Sunday as the first day of the week and number returned is the week within year, range 0-53
WeekV uses Monday as the first day of the week , week 1 is the week that includes both Jan 4 and the first Thursday of the year, returns 01-53
WeekW uses Monday as the first day of the week and returns 00 - 53.
Depending on the width of the format used, min of 2 max 200 and default of 11, you'll get year and day of week information as well.
You may want to test the results for the first few days of the year to see which one you may want for your rules. Note that depending on the actual day of the year and year some of the dates may be considered as part of the last week of the previous year.
@ogarduno wrote:
i'm getting a "ERROR: The format WEEK was not found or could not be loaded" when trying your solution. do you know what could be the problem?
untested, you can look up the appropriate format for your needs.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.