The PHREG Procedure |
Programming Statements |
Programming statements are used to create or modify the values of the explanatory variables in the MODEL statement. They are especially useful in fitting models with time-dependent explanatory variables. Programming statements can also be used to create explanatory variables that are not time dependent. For example, you can create indicator variables from a categorical variable and incorporate them into the model. PROC PHREG programming statements cannot be used to create or modify the values of the response variable, the censoring variable, the frequency variable, or the strata variables.
The following DATA step statements are available in PROC PHREG:
ABORT ARRAY assignment statements CALL DO iterative DO DO UNTIL DO WHILE END GOTO IF-THEN/ELSE LINK-RETURN PUT SELECT SUM statement
By default, the PUT statement in PROC PHREG writes results to the Output window instead of the Log window. If you want the results of the PUT statements to go to the Log window, add the following statement before the PUT statements:
FILE LOG;
DATA step functions are also available. Use these programming statements the same way you use them in the DATA step. For detailed information, refer to SAS Language Reference: Dictionary.
Consider the following example of using programming statements in PROC PHREG. Suppose blood pressure is measured at multiple times during the course of a study investigating the effect of blood pressure on some survival time. By treating the blood pressure as a time-dependent explanatory variable, you are able to use the value of the most recent blood pressure at each specific point of time in the modeling process rather than using the initial blood pressure or the final blood pressure. The values of the following variables are recorded for each patient, if they are available. Otherwise, the variables contain missing values.
survival time
censoring indicator (with 0 as the censoring value)
blood pressure on entry to the study
time 1
blood pressure at T1
time 2
blood pressure at T2
The following programming statements create a variable BP. At each time T, the value of BP is the blood pressure reading for that time, if available. Otherwise, it is the last blood pressure reading.
proc phreg; model Time*Censor(0)=BP; BP = BP0; if Time>=T1 and T1^=. then BP=BP1; if Time>=T2 and T2^=. then BP=BP2; run;
For other illustrations of using programming statements, see the section Classical Method of Maximum Likelihood and Example 64.6.
Copyright © SAS Institute, Inc. All Rights Reserved.