Date: Tue, 20 Jun 2006 13:07:37 -0500
Reply-To: Yu Zhang <zhangyu05@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yu Zhang <zhangyu05@GMAIL.COM>
Subject: Re: HTML proc report by quarters and years
In-Reply-To: <1150825770.775393.294620@r2g2000cwb.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,greg,
here is the syntax of the function: INTNX
Syntax INTNX(interval<multiple><.shift-index>, start-from, increment<,
alignment>)
Arguments
interval
specifies a character constant, a variable, or an expression that contains a
time interval such as WEEK, SEMIYEAR, QTR, or HOUR.
Requirement: The type of interval (date, datetime, or time) must match the
type of value in start-from and increment. See: Commonly Used Intervals
with Optional Multiplier and Shift Indexes
<mk:@MSITStore:C:\Program%20Files\SAS\SAS%209.1\core\help\lrdict.chm::/lrdict.hlp/a000212700.htm#a002504657>for
a list of commonly used time intervals. multiple
specifies a multiple of the interval. It sets the interval equal to a
multiple of the interval type. For example, YEAR2 consists of two-year, or
biennial, periods.
See: Incrementing Dates and Times by Using Multipliers and by Shifting
Intervals<mk:@MSITStore:C:\Program%20Files\SAS\SAS%209.1\core\help\lrdict.chm::/lrdict.hlp/a000212700.htm#a002594302>for
more information.
shift-index
specifies the starting point of the interval. By default, the starting point
is 1. A value that is greater than 1 shifts the start to a later point
within the interval. The unit for shifting depends on the interval. For
example, YEAR.3 specifies yearly periods that are shifted to start on the
first of March of each calendar year and to end in February of the following
year.
Restriction: The shift index cannot be greater than the number of periods
in the entire interval. For example, YEAR2.24 has a valid shift index, but
YEAR2.25 is invalid because there is no twenty-fifth month in a two-year
interval. Restriction: If the default shift period is the same as the
interval type, then you can shift only multiperiod intervals with the shift
index. For example, because MONTH type intervals shift by MONTH subperiods
by default, you cannot shift monthly intervals with the shift index.
However, you can shift bimonthly intervals with the shift index, because two
MONTH intervals exist in each MONTH2 interval. The interval name MONTH2.2,
for example, specifies bimonthly periods starting on the first day of
even-numbered months. See: Incrementing Dates and Times by Using Multipliers
and by Shifting
Intervals<mk:@MSITStore:C:\Program%20Files\SAS\SAS%209.1\core\help\lrdict.chm::/lrdict.hlp/a000212700.htm#a002594302>for
more information.
start-from
specifies a SAS expression that represents a SAS date, time, or datetime
value that identifies a starting point.
increment
specifies a negative, positive, or zero integer that represents the number
of date, time, or datetime intervals. Increment is the number of intervals
to shift the value of start-from.
alignment
controls the position of SAS dates within the interval. Alignment can be one
of these values:
BEGINNING
specifies that the returned date is aligned to the beginning of the
interval.
Alias: B MIDDLE
specifies that the returned date is aligned to the midpoint of the interval.
Alias: M END
specifies that the returned date is aligned to the end of the interval.
Alias: E SAMEDAY
specifies that the date that is returned is aligned to the same calendar
date with the corresponding interval increment.
Alias: S Alias: SAME Default: BEGINNING See: Aligning SAS Date Output
within Its Intervals<mk:@MSITStore:C:\Program%20Files\SAS\SAS%209.1\core\help\lrdict.chm::/lrdict.hlp/a000212700.htm#a002594479>for
more information.
On 6/20/06, Greg Curson <gscsrc@hotmail.com> wrote:
>
> Scott what am I doing wrong?
>
> 131 +data OPIB;
> 132 +set OPIA;
> 133 +PER = (cncurpay / cnawdamt)*100;
> 135 +TQuarter = INTNX(QTR,22NOV1999:00:00:00,20);
> _______ _______
> _______
> 388
> 388 388
> 76
> 76 76
> ERROR 388-185: Expecting an arithmetic operator.ERROR 388-185:
> Expecting an arithmetic operator.ERROR 388-185: Expecting an arithmetic
> operator.
>
> ERROR 76-322: Syntax error, statement will be ignored.ERROR 76-322:
> Syntax error, statement will be ignored.ERROR 76-322: Syntax error,
> statement will be ignored.
>
> Scott Barry wrote:
> > Based on your posting, here are some suggested SAS resources (SAS Data
> step functions, PROCs and
> > general data manipulation techniques) to consider:
> >
> > 1) INTNX function in a DATA step can assign a QUARTER date variable
> using the DATEPART [function]
> > and CNDTFPAY.
>
|