As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:What is my Financial Year

From sasCommunity
Jump to: navigation, search

Did you know that 04-Oct-2014 is day 20,000 in the SAS Calendar ? This is not really a tip, but it should not be allowed to pass without comment because proper use of DATE, TIME and DATETIME values within SAS make for really useful results.

20,000 days since 01-Jan-1960, that's a lot of Sun rises, I wonder where they all go ?

However, my current favourite date tip is how to take a date and determine the Financial Year into which it falls. Now this may not be everyone's most exciting thing, but I work in organisations that have different types of years for different purposes and grouping data by Financial Year is always a headache.

In New Zealand most people use the standard Financial Year ending on 31-March for tax etc. However, government organisations use a Financial Year ending 30-June and you may wish to define an academic year such as 01 September to 31 August.

The following SAS expression will take a SAS date value in Transaction_Date and return the Financial_Year into which it falls. In this example we are using a year 01-July to 30-June and so use YEAR.7 in the first parameter of the IntNx function to indicate that the starting month our Financial Year is the 7th month, July.

Financial_Year = IntNx("Year.7", Transaction_Date, 0, "END");

The expression is actually saying: Calculate the Financial_Year moving our Transaction_Date forward ZERO Years from the start of our year, where our Year starts on 01-July (hence the Year.7 in the first parameter), but then move to the END of that Year (hence the END value for the Alignment parameter).

If you change the first (interval) parameter to "Year.4" your Financial Year ends will be 31-March because then your year is defined as 01-Apr to 31-Mar.

The IntNx function (INTerval Next) function is used to move a dates up and down the calendar in chunks like months and years. Our calendar is not very linear, different months have a different number of days, and then there are Leap Years.

....[URL see also ]

....read more

Submitted By Downunder Dave (talk)