TTRAN and NTTRAN

Purpose

Specifies transformations to be carried out for each risk set (PEANUTS) or for each cell in which a subject is at risk (DATAB). The NTTRAN command drops all TTRAN code from the likelihood calculations in PEANUTS.

Programs

DATAB, PEANUTS

Syntax

TTRAN { transformation statement } { ; transformation statement ... } @

 

NTTRAN

Arguments and Subcommands

transformation statement

Code for transformation of a variable. A single TTRAN command may include multiple statements separated by semicolons. Each transformation must include an assignment, which may define new variables.

Remarks

To allow the computation of time dependent covariates, a special dynamically defined time variable can be used in the transformations. In PEANUTS, this variable %TIME, contains the time (in the units of the user's time scale) for the current risk set. In DATAB, the variables associated with each time scale contain the time at the midpoint of the current cell in the appropriate units. In DATAB there is another special variable, called pyr which contains the length of the current interval. The DELETE function has no effect in time dependent transformations.

TTRAN commands are cumulative; however, the TTRAN @ command with no arguments cancels any previously stored time dependent transformations. In PEANUTS, the time dependent covariate computations are carried out whenever TTRAN transformations have been defined. Thus, it is particularly useful to store segments of TTRAN code in a file and execute the code as needed with the  command. If no time dependent variables are used in a model, likelihood evaluations are considerably faster if the TTRAN code is removed. These can be removed using the command NTTRAN or TTRAN @. In PEANUTS, time dependent variables defined in a TTRAN command cannot be used with the STRATA command to define time-dependent strata.

Examples

a)  (DATAB example) To use the CYEAR function to compute the year at the midpoint of the current interval, to use the JULIAN function to compute the person's current age, and to compute current cumulative exposure year as a function ofage-dependent exposure rates. (It is assumed that the-user defined a calendar time scale with the command CALENDAR ctime … .)

TTRAN year = CYEAR(ctime);

 age = (ctime - JULIAN(brthyr,brthmo,brthdy))/365.25;

IF age < 20 THEN

 cexp = yrate*age

ELSE

 cexp = rate1*20 + rate2*(age-20)

ENDIF;

@

b)  (PEANUTS example) To define a simple time dependent covariate as an interaction with log follow-up time and to define a categorical time since last exposure variable based upon whether the current time is greater than time of last employment:

TRAN tmlast = lastemp - agein @

TTRAN v3 = v1*log(%time);

 cess = (%time > tmlast) +

 (%time > tmlast+5) +

 (%time > tmlast+10);

@

TLEVEL cess @

c)  To cancel all earlier TTRAN transformations:

TTRAN @