BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hhchenfx
Barite | Level 11

Hi Everyone,

I would like SAS to return previous working day.

Can you please help?

Thanks,

HHC

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

The basic function is:

 

prevWeekDay = intnx("WEEKDAY", myDate, -1);

PG

View solution in original post

5 REPLIES 5
ballardw
Super User

Define "working day".

There really is not a universal definition for that. When I was in the US Army every day was a "working day".

If Holidays are to be excluded then which ones, and in which country (some holidays of the same name are celebrated on different calendar dates in different countries).

hhchenfx
Barite | Level 11

Hi,

I meant simple US business day or normal week day.

Thanks,

HHC

 

PGStats
Opal | Level 21

The basic function is:

 

prevWeekDay = intnx("WEEKDAY", myDate, -1);

PG
hhchenfx
Barite | Level 11

Thank you so much!

HHC

ballardw
Super User

@hhchenfx wrote:

Hi,

I meant simple US business day or normal week day.

Thanks,

HHC

 


I'll reiterate: there ain't such a thing.  If you mean to exclude Federal Holidays on the observed days that's fine, say so but many organization pick and choose which to follow. The SAS Holidayname function returns the names of holidays associated with a given date. So you can test a candidate date to see if it is one of the holidays you expect to observe. If it is then use the INTNX function to get the previous day to test.

When I worked for a University they did not observe Columbus Day or Veterans day.

Many many companies work every day of a typical week and only observe a very few holidays.

A survey company I worked for that typically worked Saturdays  would not work on Saturdays that coincided with certain sporting events.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1172 views
  • 1 like
  • 3 in conversation