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

## Previous working day

Hi Everyone,

I would like SAS to return previous working day.

Can you please help?

Thanks,

HHC

1 ACCEPTED SOLUTION

Accepted Solutions
Opal | Level 21

## Re: Previous working day

The basic function is:

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

PG
5 REPLIES 5
Super User

## Re: Previous working day

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

Barite | Level 11

## Re: Previous working day

Hi,

I meant simple US business day or normal week day.

Thanks,

HHC

Opal | Level 21

## Re: Previous working day

The basic function is:

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

PG
Barite | Level 11

## Re: Previous working day

Thank you so much!

HHC

Super User

## Re: Previous working day

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

Discussion stats
• 5 replies
• 880 views
• 1 like
• 3 in conversation