The TRANSREG Procedure

Output Data Set

The OUT= output data set can contain a great deal of information; however, in most cases, the output data set contains a small portion of the entire range of available information.

Output Data Set Examples

This section provides three brief examples, illustrating some typical OUT= output data sets. See the section Output Data Set Contents for a complete list of the contents of the OUT= data set.

The first example shows the output data set from a two-way ANOVA model. The following statements produce Figure 119.65:

title 'ANOVA Output Data Set Example';

data ReferenceCell;
   input y x1 $ x2 $;
   datalines;
11  a  a
12  a  a
10  a  a
 4  a  b
 5  a  b
 3  a  b
 5  b  a
 6  b  a
 4  b  a
 2  b  b
 3  b  b
 1  b  b
;
* Fit Reference Cell Two-Way ANOVA Model;
proc transreg data=ReferenceCell;
   model identity(y) = class(x1 | x2);
   output coefficients replace predicted residuals;
run;

* Print the Results;
proc print;
run;

proc contents position;
   ods select position;
run;

Figure 119.65: ANOVA Example Output Data Set Contents

ANOVA Output Data Set Example

Obs_TYPE__NAME_yPyRyInterceptx1ax2ax1ax2ax1x2
1SCOREROW11111011.011aa
2SCOREROW21211111.011aa
3SCOREROW31011-111.011aa
4SCOREROW444011.000ab
5SCOREROW554111.000ab
6SCOREROW634-111.000ab
7SCOREROW755010.010ba
8SCOREROW865110.010ba
9SCOREROW945-110.010ba
10SCOREROW1022010.000bb
11SCOREROW1132110.000bb
12SCOREROW1212-110.000bb
13M COEFFIy...22.034  
14MEANy....7.5811  

ANOVA Output Data Set Example

The CONTENTS Procedure

Variables in Creation Order
#VariableTypeLenLabel
1_TYPE_Char8 
2_NAME_Char32 
3yNum8 
4PyNum8y Predicted Values
5RyNum8y Residuals
6InterceptNum8Intercept
7x1aNum8x1 a
8x2aNum8x2 a
9x1ax2aNum8x1 a * x2 a
10x1Char32 
11x2Char32 


The _TYPE_ variable indicates observation type: score, multiple regression coefficient (parameter estimates), and marginal means. The _NAME_ variable contains the default observation labels, "ROW1", "ROW2", and so on, and contains the dependent variable name (y) for the remaining observations. If you specify an ID statement, _NAME_ contains the values of the first ID variable for score observations. The y variable is the dependent variable, Py contains the predicted values, Ry contains the residuals, and the variables Intercept through x1ax2a contain the design matrix. The x1 and x2 variables are the original CLASS variables.

The next example shows the contents of the output data set from fitting a curve through a scatter plot. The following statements produce Figure 119.66:

title 'Output Data Set for Curve Fitting Example';

data a;
   do x = 1 to 100;
      y = log(x) + sin(x / 10) + normal(7);
      output;
   end;
run;

proc transreg;
   model identity(y) = spline(x / nknots=9);
   output predicted out=b;
run;

proc contents position;
   ods select position;
run;

Figure 119.66: Predicted Values Example Output Data Set Contents

Output Data Set for Curve Fitting Example

The CONTENTS Procedure

Variables in Creation Order
#VariableTypeLenLabel
1_TYPE_Char8 
2_NAME_Char32 
3yNum8 
4TyNum8y Transformation
5PyNum8y Predicted Values
6InterceptNum8Intercept
7xNum8 
8TInterceptNum8Intercept Transformation
9TxNum8x Transformation


The OUT= data set contains _TYPE_ and _NAME_ variables. Since no coefficients or coordinates are requested, all observations are _TYPE_=’SCORE’. The y variable is the original dependent variable, Ty is the transformed dependent variable, Py contains the predicted values, x is the original independent variable, and Tx is the transformed independent variable. The data set also contains an Intercept and transformed intercept TIntercept variable. (In this case, the transformed intercept is the same as the intercept. However, if you specify the TSTANDARD= and ADDITIVE options, these are not always the same.)

The following example shows the results from specifying METHOD=MORALS when there is more than one dependent variable:

title 'METHOD=MORALS Output Data Set Example';

data x;
   input y1 y2 x1 $ x2 $;
   datalines;
11 1 a a
10 4 b a
 5 2 a b
 5 9 b b
 4 3 c c
 3 6 b a
 1 8 a b
;
* Fit Reference Cell Two-Way ANOVA Model;
proc transreg data=x noprint solve;
   model spline(y1 y2) = opscore(x1 x2 / name=(n1 n2));
   output coefficients predicted residuals;
   id x1 x2;
run;

* Print the Results;
proc print;
run;

proc contents position;
   ods select position;
run;

These statements produce Figure 119.67.

Figure 119.67: METHOD=MORALS Rolled Output Data Set

METHOD=MORALS Output Data Set Example

Obs_DEPVAR__TYPE__NAME__DEPEND_T_DEPEND_P_DEPEND_R_DEPEND_Interceptn1n2TInterceptTn1Tn2x1x2
1Spline(y1)SCOREa1113.160011.15542.004641001.00000.06711-0.09384aa
2Spline(y1)SCOREb106.19316.8835-0.690411101.00001.51978-0.09384ba
3Spline(y1)SCOREa52.44674.7140-2.267241011.00000.067111.32038ab
4Spline(y1)SCOREb52.44670.44212.004641111.00001.519781.32038bb
5Spline(y1)SCOREc44.20764.20760.000001221.00000.239321.32038cc
6Spline(y1)SCOREb35.56936.8835-1.314221101.00001.51978-0.09384ba
7Spline(y1)SCOREa14.97664.71400.262611011.00000.067111.32038ab
8Spline(y1)M COEFFIy1.......10.9253-2.94071-4.55475y1y1
9Spline(y2)SCOREa1-0.5303-0.5199-0.010431001.00000.03739-0.09384aa
10Spline(y2)SCOREb45.54874.56890.979881101.00001.51395-0.09384ba
11Spline(y2)SCOREa23.89404.5575-0.663471011.00000.037391.32038ab
12Spline(y2)SCOREb99.63589.6462-0.010431111.00001.513951.32038bb
13Spline(y2)SCOREc35.62105.62100.000001221.00000.345981.32038cc
14Spline(y2)SCOREb63.59944.5689-0.969451101.00001.51395-0.09384ba
15Spline(y2)SCOREa85.23144.55750.673901011.00000.037391.32038ab
16Spline(y2)M COEFFIy2.......-0.31193.446363.59024y2y2

METHOD=MORALS Output Data Set Example

The CONTENTS Procedure

Variables in Creation Order
#VariableTypeLenLabel
1_DEPVAR_Char42Dependent Variable Transformation(Name)
2_TYPE_Char8 
3_NAME_Char32 
4_DEPEND_Num8Dependent Variable
5T_DEPEND_Num8Dependent Variable Transformation
6P_DEPEND_Num8Dependent Variable Predicted Values
7R_DEPEND_Num8Dependent Variable Residuals
8InterceptNum8Intercept
9n1Num8 
10n2Num8 
11TInterceptNum8Intercept Transformation
12Tn1Num8n1 Transformation
13Tn2Num8n2 Transformation
14x1Char32 
15x2Char32 


If you specify METHOD=MORALS with multiple dependent variables, PROC TRANSREG performs separate univariate analyses and stacks the results in the OUT= data set. For this example, the results of the first analysis are in the partition designated by _DEPVAR_=’Spline(y1)’ and the results of the second analysis are in the partition designated by _DEPVAR_=’Spline(y2)’, which are the transformation and dependent variable names. Each partition has _TYPE_=’SCORE’ observations for the variables and a _TYPE_=’M COEFFI’ observation for the coefficients. In this example, an ID variable is specified, so the _NAME_ variable contains the formatted values of the first ID variable. Since both dependent variables have to go into the same column, the dependent variable is given a new name, _DEPEND_. The dependent variable transformation is named T_DEPEND_, the predicted values variable is named P_DEPEND_, and the residuals variable is named R_DEPEND_.

The independent variables are character OPSCORE variables. By default, PROC TRANSREG replaces character OPSCORE variables with category numbers and discards the original character variables. To avoid this, the input variables are renamed from x1 and x2 to n1 and n2 and the original x1 and x2 are added to the data set as ID variables. The n1 and n2 variables contain the initial values for the OPSCORE transformations, and the Tn1 and Tn2 variables contain optimal scores. The data set also contains an Intercept and transformed intercept TIntercept variable. The regression coefficients are in the transformation columns, which also contain the variables to which they apply.

Output Data Set Contents

Table 119.6 summarizes the various matrices that can result from PROC TRANSREG processing and that appear in the OUT= data set. The exact contents of an OUT= data set depends on many options.

Table 119.6: PROC TRANSREG OUT= Data Set Contents

_TYPE_

Contents

Options, Default Prefix

SCORE

dependent variables

DREPLACE not specified

SCORE

independent variables

IREPLACE not specified

SCORE

transformed dependent variables

default, TDPREFIX=T

SCORE

transformed independent variables

default, TIPREFIX=T

SCORE

predicted values

PREDICTED, PPREFIX=P

SCORE

residuals

RESIDUALS, RDPREFIX=R

SCORE

leverage

LEVERAGE, LEVERAGE=Leverage

SCORE

lower individual confidence limits

CLI, LILPREFIX=LIL,

  

CILPREFIX=CIL

SCORE

upper individual confidence limits

CLI, LIUPREFIX=LIU,

  

CIUPREFIX=CIU

SCORE

lower mean confidence limits

CLM, LMLPREFIX=LML,

  

CMLPREFIX=CML

SCORE

upper mean confidence limits

CLM, LMUPREFIX=LMU,

  

CMUPREFIX=CMU

SCORE

dependent canonical variables

CANONICAL, CDPREFIX=Cand

SCORE

independent canonical variables

CANONICAL, CIPREFIX=Cani

SCORE

redundancy variables

REDUNDANCY, RPREFIX=Red

SCORE

ID, CLASS, BSPLINE variables

ID, CLASS, BSPLINE,

SCORE

independent variables approximations

IAPPROXIMATIONS, AIPREFIX=A

M COEFFI

multiple regression coefficients

COEFFICIENTS, MRC

C COEFFI

canonical coefficients

COEFFICIENTS, CCC

MEAN

marginal means

COEFFICIENTS, MEANS

M REDUND

multiple redundancy coefficients

MREDUNDANCY

R REDUND

multiple redundancy coefficients

MREDUNDANCY

M POINT

point coordinates

COORDINATES or MPC, POINT

M EPOINT

elliptical point coordinates

COORDINATES or MEC, EPOINT

M QPOINT

quadratic point coordinates

COORDINATES or MQC, QPOINT

C POINT

canonical point coordinates

COORDINATES or CPC, POINT

C EPOINT

canonical elliptical point coordinates

COORDINATES or CEC, EPOINT

C QPOINT

canonical quadratic point coordinates

COORDINATES or CQC, QPOINT


The independent and dependent variables are created from the original input data. Several potential differences exist between these variables and the actual input data. An intercept variable can be added, new variables can be added for POINT, EPOINT, QPOINT, CLASS, IDENTITY, PSPLINE, and BSPLINE variables, and category numbers are substituted for character OPSCORE variables. These matrices are not always what is input to the first iteration. After the expanded data set is stored for inclusion in the output data set, several things happen to the data before they are input to the first iteration: column means are substituted for missing values; zero-degree SPLINE and MSPLINE variables are transformed so that the iterative algorithms get step-function data as input, which conform to the zero-degree transformation family restrictions; and the nonoptimal transformations are performed.

Details for the UNIVARIATE Method

When you specify METHOD=UNIVARIATE (in the MODEL or PROC TRANSREG statement), PROC TRANSREG can perform several analyses, one for each dependent variable. While each dependent variable can be transformed, their independent variables are not transformed. The OUT= data set optionally contains all of the _TYPE_=’SCORE’ observations, optionally followed by coefficients or coordinates.

Details for the MORALS Method

When you specify METHOD=MORALS (in the MODEL or PROC TRANSREG statement), successive analyses are performed, one for each dependent variable. Each analysis transforms one dependent variable and the entire set of the independent variables. All information for the first dependent variable (scores then, optionally, coefficients) appears first. Then all information for the second dependent variable (scores then, optionally, coefficients) appears next. This arrangement is repeated for all dependent variables.

Details for the CANALS and REDUNDANCY Methods

For METHOD=CANALS and METHOD=REDUNDANCY (specified in either the MODEL or PROC TRANSREG statement), one analysis is performed that simultaneously transforms all dependent and independent variables. The OUT= data set optionally contains all of the _TYPE_=’SCORE’ observations, optionally followed by coefficients or coordinates.

Variable Names

As shown in the preceding examples, some variables in the output data set directly correspond to input variables, and some are created. All original optimal and nonoptimal transformation variable names are unchanged.

The names of the POINT, QPOINT, and EPOINT expansion variables are also left unchanged, but new variables are created. When independent POINT variables are present, the sum-of-squares variable _ISSQ_ is added to the output data set. For each EPOINT and QPOINT variable, a new squared variable is created by appending "_2". For example, Dim1 and Dim2 are expanded into Dim1, Dim2, Dim1_2, and Dim2_2. In addition, for each pair of QPOINT variables, a new crossproduct variable is created by combining the two names—for example, Dim1Dim2.

The names of the CLASS variables are constructed from original variable names and levels. Lengths are controlled by the CPREFIX= a-option. For example, when x1 and x2 both have values of ’a’ and ’b’, CLASS(x1 | x2 / ZERO=NONE) creates x1 main-effect variable names x1a x1b, x2 main-effect variable names x2a x2b, and interaction variable names x1ax2a x1ax2b x1bx2a x1bx2b.

PROC TRANSREG then uses these variable names when creating the transformed, predicted, and residual variable names by affixing the relevant prefix and dropping extra characters if necessary.

METHOD=MORALS Variable Names

When you specify METHOD=MORALS and only one dependent variable is present, the output data set is structured exactly as if METHOD=REDUNDANCY (see the section Details for the CANALS and REDUNDANCY Methods). When more than one dependent variable is present, the dependent variables are output in the variable _DEPEND_, transformed dependent variables are output in the variable T_DEPEND_, predicted values are output in the variable P_DEPEND_, and residuals are output in the variable R_DEPEND_. You can partition the data set into BY groups, one per dependent variable, by referring to the character variable _DEPVAR_, which contains the original dependent variable names and transformations.

Duplicate Variable Names

When the same name is generated from multiple variables in the OUT= data set, new names are created by appending ’2’, ’3’, or ’4’, and so on, until a unique name is created. For 32-character names, the last character is replaced with a numeric suffix until a unique name is created. For example, if there are two output variables that otherwise would be named x, then x and x2 are created instead. If there are two output variables that otherwise would be named ThisIsAThirtyTwoCharacterVarName, then ThisIsAThirtyTwoCharacterVarName and ThisIsAThirtyTwoCharacterVarNam2 are created instead.