Published on :
Statistical CREATION_INTERNE

Survival Analysis for Boron Neutron Capture Therapy

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating three distinct datasets ('control', 'rad', 'radbpa') using DATA blocks and datalines statements to integrate survival time and censoring data. Each dataset represents a different treatment group within a study. These three datasets are then combined into a single dataset named 'prob7_7'. Two indicator variables ('grp1', 'grp2') are created to facilitate the identification of the 'rad' and 'radbpa' groups in subsequent analyses. After a summary display of the combined data via PROC PRINT for verification, the core of the analysis is performed by PROC LIFETEST. This procedure is configured to estimate and compare survival functions (Kaplan-Meier by default) and hazard functions between the three groups ('trt') with a Bonferroni correction for multiple comparisons. It also generates survival and hazard plots for result visualization. Symbolization options are used to differentiate the appearance of curves in the plots.
Data Analysis

Type : CREATION_INTERNE


The data (`time`, `censor`, `trt`) is entirely created internally within the SAS script via DATA blocks and `datalines` statements. There is no dependency on external files or pre-existing SAS libraries for raw data acquisition, other than the data generated by the script itself.

1 Code Block
DATA STEP Data
Explanation :
This DATA block creates a dataset named `control`. It uses the `datalines` statement to read the values of the `time` and `censor` variables. A `trt` variable is assigned the value 'control' to identify this as the untreated group. The syntax ` @code_sas_json/hsdua2304@gmail.com_SAS_Assignment_1.json` found in the original code on the `input` line has been removed as it is a syntax error and does not correspond to the `datalines` reading mechanism. The value 'controp' has been corrected to 'control' to ensure code consistency and executability.
Copied!
1DATA control; /*create data set for untreated group*/
2INPUT time censor;
3trt='control'; /*Correction de 'controp' en 'control' pour cohérence avec le commentaire*/
4DATALINES;
520 1 21 1 23 1 24 1 24 1 26 1 26 1 27 1 28 1 30
6;
7 
2 Code Block
DATA STEP Data
Explanation :
This DATA block creates a dataset named `rad` for the radiation-treated group. Similar to the previous block, it reads `time` and `censor` data via `datalines` and assigns the value 'rad' to the `trt` variable. The syntax ` @code_sas_json/hsdua2304@gmail.com_SAS_Assignment_1.json` found in the original code on the `input` line has been removed as it is a syntax error and does not correspond to the `datalines` reading mechanism.
Copied!
1DATA rad; /*create data set for the radiated group*/
2INPUT time censor;
3trt='rad';
4DATALINES;
526 1 28 1 29 1 29 1 30 1 30 1 31 1 31 1 32 1 35 0
6;
7 
3 Code Block
DATA STEP Data
Explanation :
This DATA block creates a dataset named `radbpa` for the radiation and BPA-treated group. It reads `time` and `censor` data via `datalines` and assigns the value 'radbpa' to the `trt` variable. The syntax ` @code_sas_json/hsdua2304@gmail.com_SAS_Assignment_1.json` found in the original code on the `input` line has been removed as it is a syntax error and does not correspond to the `datalines` reading mechanism.
Copied!
1DATA radbpa; /*Create data set for the raduated + BPA group*/
2INPUT time censor;
3trt='radbpa';
4DATALINES;
531 1 32 1 34 1 35 1 36 1 38 1 38 1 39 1 42 0 42 0
6;
7 
4 Code Block
DATA STEP Data
Explanation :
This DATA block combines the three previously created datasets (`control`, `rad`, `radbpa`) into a new single dataset named `prob7_7`. It also creates two binary variables `grp1` (equals 1 if `trt` is 'rad', 0 otherwise) and `grp2` (equals 1 if `trt` is 'radbpa', 0 otherwise) to facilitate comparisons. The `title` and `title3` statements define titles for subsequent outputs, particularly for the `PROC PRINT` and `PROC LIFETEST` procedures.
Copied!
1DATA prob7_7; SET control rad radbpa; /*Combine all these three samples*/
2grp1=(trt='rad');
3grp2=(trt='radbpa');
4title 'Problem 7_7, page 240 --Boron neutron capture therapy';
5title3 'grp1=rad, grp2=radbpa';
6;
5 Code Block
PROC PRINT
Explanation :
This procedure displays the content of the last created or active dataset, which is `prob7_7` in this context. It is used for a quick inspection of the combined data and to verify the accuracy of the group merge.
Copied!
1PROC PRINT;
6 Code Block
PROC LIFETEST
Explanation :
This procedure performs a survival analysis on the `prob7_7` dataset. `plots=(s,h)` and `graphics` generate plots of survival functions (S, Kaplan-Meier by default) and cumulative hazard functions (H). `time time*censor(0)` specifies that `time` is the time variable and `censor` is the event variable where 0 indicates a censored observation (the event did not occur). `strata trt/adjust=bon` requests a stratified analysis by the `trt` variable ('control', 'rad', 'radbpa' groups) and applies Bonferroni correction for multiple comparisons between strata to adjust p-values. The `symbol1`, `symbol2`, `symbol3` statements customize the appearance of the curves in the generated plots for better visual distinction of the groups.
Copied!
1/*Compare three groups, plot the survival functions and hazard functions*/
2PROC LIFETEST DATA=prob7_7 plots=(s,h) graphics;
3time time*censor(0);
4strata trt/adjust=bon;
5symbol1 v=none color=black line=1;
6symbol2 v=none color=black line=2;
7symbol3 v=none color=black line=3;
8RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : SAS Code for problem 7.7 from the manual 'Survival Analysis Techniques for Censored and Truncated Data'.