The script is divided into four main analyses. The first two use the life-table method (METHOD=LIFE) on angina and lung cancer data, where data is grouped into time intervals. The third analysis uses the Kaplan-Meier estimator (METHOD=KM) on cancer data, generating an output survival table. The last analysis focuses on Hodgkin's disease and uses a stratified analysis (STRATA) to compare the survival functions of two distinct patient groups and visualize them on the same graph.
Data Analysis
Type : CREATION_INTERNE
All data required for the analysis (angina, lungcancer, cancer, hodgkin) are created directly within the script using DATA STEP instructions and in-line data (CARDS). No external data source is required.
1 Code Block
DATA STEP Data
Explanation : This block creates the 'angina' table from internal data. Variables are 'time', 'censor' (censoring indicator), and 'rep' (frequency). The '@@' operator allows reading multiple observations from the same data line.
INPUT time censor rep @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3
CARDS;
4
0.514560.5 0 0 1.512261.5 0 39
5
2.511522.5 0 223.511713.5 0 23
6
4.511354.5 0 245.511255.5 0 107
7
6.51836.5 0 1337.51747.5 0 102
8
8.51518.5 0 689.51429.5 0 64
9
10.514310.5 0 4511.513411.5 0 53
10
12.511812.5 0 3313.51913.5 0 27
11
14.51614.5 0 2315.51 0 15.5 0 30
12
;
13
RUN;
2 Code Block
PROC LIFETEST
Explanation : Performs a survival analysis on the 'angina' table using the life-table method (METHOD=LIFE) with specified intervals. It generates plots for the survival function (S) and the hazard function (H). The TIME statement defines the time variable and the censoring indicator (value 0). The FREQ statement specifies the frequency variable.
Explanation : Creates the 'cancer' table with individual survival times and a censoring indicator, preparing the data for a Kaplan-Meier type analysis.
INPUT time censor @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3
CARDS;
4
2.014.015.0110.01
5
10.0 0 12112 0 141
6
14115116 0 181
7
19 0 23125126 0
8
27130 0 311341
9
35137 0 381391
10
42 0 43 0 46147 0
11
49150153 0 54 0
12
;
13
RUN;
6 Code Block
PROC LIFETEST
Explanation : Performs a survival analysis with the Kaplan-Meier estimator (METHOD=KM). It generates a survival curve plot and saves the survival estimates into a new table named 'a' using the 'outsurv=a' option.
Explanation : Displays the content of table 'a', which contains the detailed results of the survival function estimation calculated by the previous PROC LIFETEST step.
Copied!
proc print data = a;
run;
1
PROC PRINTDATA = a;
2
RUN;
8 Code Block
DATA STEP Data
Explanation : Creates the 'hodgkin' table containing data on Hodgkin's disease. It includes the 'group' variable which allows distinguishing two different patient cohorts.
INPUT time censor group @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json ;
3
CARDS;
4
111211511511511
5
711911111111111311
6
131116112011211122 0 1
7
221131 0 133 0 137 0 14311
8
112312412412512712
9
71291291214 0 2171219 0 2
10
27 0 230 0 241 0 2
11
;
12
RUN;
9 Code Block
PROC LIFETEST
Explanation : Performs a stratified survival analysis on the 'hodgkin' table. The 'STRATA group' statement instructs the procedure to calculate and test distinct survival functions for each value of the 'group' variable, allowing comparison of the two patient groups. The SYMBOL statements customize the appearance of lines on the survival plot.
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.