BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ogarduno
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

4 REPLIES 4
Reeza
Super User

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;
ogarduno
Obsidian | Level 7

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?

ballardw
Super User

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.

 

 

Reeza
Super User

@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.

 

http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#p07rezhgdv34...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 516 views
  • 1 like
  • 3 in conversation