INTSEAS Function
Returns the length of the seasonal cycle when a date, time, or datetime interval is specified.
| Categories: | Date and Time |
| CAS |
Syntax
Required Argument
interval
specifies a character constant, a variable, or an expression that contains an interval name such as WEEK, MONTH, or QTR. Interval can appear in uppercase or lowercase.
interval<multiple.shift-index>
The three parts of the interval name are as follows:
interval
specifies the name of the basic interval type. For example, YEAR specifies yearly intervals.
multiple
specifies an optional multiplier that sets the interval equal to a multiple of the period of the basic interval type. For example, the interval YEAR2 consists of two-year, or biennial, periods.
| See | Incrementing Dates and Times By Using Multipliers and By Shifting Intervals for more information. |
shift-index
specifies an optional shift index that shifts the interval to start at a specified subperiod starting point. For example, YEAR.3 specifies yearly periods shifted to start on the first of March of each calendar year and to end in February of the following year.
| Restrictions | The shift index cannot be greater than the number of subperiods in the whole interval. For example, you could use YEAR2.24, but YEAR2.25 would be an error because there is no 25th month in a two-year interval. |
| If the default shift period is the same as the interval type, then only multiperiod intervals can be shifted with the optional shift index. For example, because MONTH type intervals shift by MONTH subperiods by default, monthly intervals cannot be shifted with the shift index. However, bimonthly intervals can be shifted with the shift index, because there are two MONTH intervals in each MONTH2 interval. For example, the interval name MONTH2.2 specifies bimonthly periods starting on the first day of even-numbered months. | |
| See | Incrementing Dates and Times By Using Multipliers and By Shifting Intervals for more information. |
Optional Argument
seasonality
specifies a number or a cycle.
INTSEAS('WEEK',
53);. By default, INTSEAS('WEEK'); equals 52.
| Example | The function INTSEAS('interval', seasonality); returns
a number when you specify a numeric value for seasonality.
The function INTSEAS('MONTH', 'QTR'); returns
a value of 3 when you specify the QTR cycle. |
Details
The Basics
Retail Calendar Intervals
Seasonality
Example
|
SAS Statement
|
Result
|
|---|---|
cycle_years=intseas('year');
put cycle_years; |
1 |
cycle_smiyears=intseas('semiyear');
put cycle_smiyears; |
2 |
cycle_quarters=intseas('quarter');
put cycle_quarters; |
4 |
cycle_number=intseas('month', 'qtr');
put cycle_number; |
3 |
cycle_months=intseas('month');
put cycle_months; |
12 |
cycle_smimonths=intseas('semimonth');
put cycle_smimonths; |
24 |
cycle_tendays=intseas('tenday');
put cycle_tendays; |
36 |
cycle_weeks=intseas('week');
put cycle_weeks; |
52 |
cycle_wkdays=intseas('weekday');
put cycle_wkdays; |
5 |
cycle_hours=intseas('hour');
put cycle_hours; |
24 |
cycle_minutes=intseas('minute');
put cycle_minutes; |
60 |
cycle_month2=intseas('month2.2');
put cycle_month2; |
6 |
cycle_week2=intseas('week2');
put cycle_week2; |
26 |
var1='month4.3'; cycle_var1=intseas(var1); put cycle_var1; |
3 |
cycle_day1=intseas('day1');
put cycle_day1; |
7 |