%RMPROINT

%RMPROINT Overview

The %RMPROINT macro creates an output SAS view that converts the values of the variables of data type C2RATE or D2RATE from counters or deltas into rates. This macro processes either counters or deltas in a single invocation (but not both). If DURATION is missing, then the macro also sets the value of DURATION to be the difference between successive values of the variable DATETIME within one BY group.

%RMPROINT Syntax

%RMPROINT(
ADAPTER=adapter-name
,BYGROUP=list-of-BY-vars
,IN=input-SAS-table
,OUT=output-SAS-table
,VARS=list-of-vars
<,CONVERT=C2RATE>
<,_RBDF=relative-bad-delta-factor>
);

%RMPROINT Required Arguments

ADAPTER=adapter-name
specifies the name of the adapter to which the table belongs.
BYGROUP=bygroup
specifies the space-delimited list of BY variables that govern how this data is sorted.
IN=infile
specifies the input SAS table.
OUT=outfile
specifies the output SAS table. (This table can be the same as the input table.)
VARS=variable-name
specifies the space-delimited list of variables that require conversion.

%RMPROINT Options

CONVERT=conversion-type
specifies the type of conversion to be performed. The following values are valid for conversion-type:
  • C2RATE
    The data is converted from counter to rate. The default value for this option is C2RATE.
  • D2RATE
    The data is converted from the delta value to rate.
_RBDF=relative-bad-delta-factor
specifies the name of the SAS macro variable that is created that contains the Relative Bad Delta Factor as a percentage. The default value of this option is RBDFTMP.

%RMPROINT Notes

The %RMPROINT macro converts metrics that are considered counters or deltas to rates. A counter is a metric whose value is constantly increasing. A delta is a metric whose value represents the difference between the value of a counter at the start and end of an interval of time. The rate is determined by taking the delta metric (or by calculating the delta from the counter) and dividing it by the duration of the interval. The following table lists the counters that are converted to rates for the NTSMF Adapter.
List of Counters That Are Converted to Rates for NTSMF Adapters
NTSMCNT Table
NTTCP Table
ALMSGKB
CNCACTV
EXTMSGS
CNCFLRS
EXTRMKB
CNCTPSV
INTMSGS
CNCTRST
INTRMKB
TTLMSGS
The following table lists the counters that are converted to rates for the SAR Adapter.
List of Counters That Are Converted to Rates for SAR Adapters
XTYTCPS TABLE
ICIMDEU
ICOMDEU
IMFQGOK
IMRMSOK
ICIMECQ
ICOMECQ
IMFGCRE
IMRMSRE
ICIMECR
ICOMECR
IMFGFLD
IMRSMAC
ICICERR
ICOMERR
IMIADRE
IMRSMFU
ICIMIPP
ICOMIPP
IMIDELV
IMRSMTO
ICIMISQ
ICOMISQ
IMIDISC
IMRTDIS
ICIMITE
ICOMITE
IMIFWDD
IMSMFLD
ICIMMKQ
ICOMMKQ
IMIHDRE
INSEGS
ICIMMKR
ICOMMKR
IMIRECV
OUTSEGS
ICIMRED
ICOMRED
IMIUNPR
USINDGR
ICIMSGS
ICOMSGS
IMODISC
USINERR
ICIMTIQ
ICOMTIQ
IMONORT
USNOPRT
ICIMTIR
ICOMTIR
IMOREQS
USOTDGR
For example, if you have recorded odometer mileage and the start time of each mileage reading, then the counter is mileage. When this macro is executed, the duration is determined by calculating the difference between the start times of one observation and the preceding observation. Then, the number of miles per second can be calculated for each observation. To calculate the number of miles per second, find the difference between the odometer mileage of one observation and the mileage of the preceding observation, and then divide the result by the duration in seconds.
A counter continues increasing across all intervals until it reaches its maximum value and then, typically, it resets to zero and starts again. The counter maximums are 65,536 (for a 16-bit counter), 4,294,967,296 (for a 32-bit counter), and 18,446,744,073,709,551,616 (for a 64-bit counter). Using the previous and current value of the counter and knowing the maximum limit for that particular counter, it is possible to calculate the rate for that interval, based on these assumptions:
  • If the previous value is smaller than the current value, it is assumed that the counter has not reset.
  • If the previous value is larger than the current value, it is assumed that the counter has reset one time.
Note: For information about “Length and Precision of Variables” when using any 64-bit counter, see the SAS Companion documentation for your host.

Fast-Moving Counters

A problem that exists, especially for 16-bit counters, is that fast-moving counters can reset more than one time during an interval. One way to resolve this problem is to sample at a shorter interval so that there is not enough time during the interval for the counters to reset more than once.
SAS IT Resource Management also provides another way to resolve this problem. Although SAS IT Resource Management converts counters to rates automatically, there are three macro variables that you can use to affect how the conversion is done. By default, these macro variables are set as follows:
  • Macro variable CP16PCT is for use with 16-bit counters. By default, it is set as follows:
    %let cp16pct = 0.95;
    As a result of this setting, a threshold is calculated for 16-bit counters, and the threshold has the value of: 0.95 * 65536 = 62259.2.
  • Macro variable CP32PCT is for use with 32-bit counters. By default, it is set as follows:
    %let cp32pct = 0.97;
    As a result of this setting, a threshold is calculated for 32-bit counters, and the threshold has the value of 0.97*4292967296 = 4164178277.
  • Macro variable CP64PCT is for use with 64-bit counters. By default, it is set as follows:
    %let cp64pct = 0.97;
    As a result of this setting, a threshold is calculated for 64-bit counters, and the threshold has the value of 0.97*18446744073709551616 = 17893341751498265067.
When a rate is being determined and the current value is less than the previous value, then one of the following situations might have occurred:
  • If the previous value is greater than or equal to the threshold, the rate is calculated based on the assumption that one reset occurred during the interval. That is, the previous value was so close to the counter's maximum that it is possible that it was reset once during the interval.
    In this case, a "Corrected" message (see the following example) is written to the SAS log.
  • If the previous value is less than the threshold, the rate is not calculated, and, instead, the rate is set to missing. That is, the previous value is so far from the counter's maximum that the counter must have been moving extremely fast to reset during the interval. And if the counter is moving that fast, it is possible that it was reset more than one time during that interval.
    In this case, a "Set to missing" message (see the following example) is written to the SAS log.
Example
The following example illustrates the situation for a 16-bit counter, assuming 5-minute intervals:
Table of Counters and Calculated Rates
Counter Value
Calculated Rate
20000
.
40000
66.67
62260
72.20
300
11.92
4000
132.33
62259
74.19
2000
.
In the preceding table, the calculated rates for the first three counter values are computed according to the following rules:
  • The first observation's rate is missing, because there is no previous value with which to calculate the difference.
  • The first time the counter resets, the value preceding the reset (62260) meets (or exceeds) the default threshold of 95% for 16-bit counters (62259.2). The rate is therefore calculated based on one reset, and the following message is written to the SAS log:
    (CLEANUP)Obs4 16 bit Overflow Start 01JAN01:00:10:00 SVAL=62260 Corrected End 01JAN2001:00:15:00.00 SVAL=300
  • The second time the counter resets, the value preceding the reset (62259) does not meet (or exceed) the default threshold of 95% for 16-bit counters (62259.2). The rate is therefore set to missing, and the following message is written to the SAS log:
    (CLEANUP)Obs 7 Inconsistent Start 01JAN01:00:25:00 SVAL=62259 Set to missing End 01JAN2001:00:30:00.00 SVAL=2000
If a large percentage of your data is producing the second type of message, the work that is measured by the counters might have increased so much that the counters are resetting more than one time within an interval. Take one or both of the following actions as needed:
  • Reduce the interval at which you sample, although this will increase the volume of data that you collect.
  • Lower the thresholds. For example, you could insert the following SAS statement in the process-and-reduce job before the call to the process macro:
    %let cp16pct=0.94;
    
    Note: As you lower the thresholds, more rates are calculated, but the rates might be incorrect because of multiple resets due to fast-moving counters.

%RMPROINT Example

If you are working with a supported adapter, this macro is submitted automatically when necessary. If you are working with user-written staging code, you must submit the macro yourself if it is needed. To do so, execute it as a separate step in a job after the data has been staged.
DATA
....

staging code goes here
.....
run;
%rmproint(...);