Published on :
Général CREATION_INTERNE

Sans titre

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating two datasets, 'renyi1' and 'renyi2', from integrated raw data (CARDS statement). Each dataset contains information on survival days and censorship status. A 'group' variable is then added to each dataset to identify the treatment groups (1 for chemotherapy, 2 for chemotherapy + radiotherapy). The two datasets are then combined into a single dataset, 'renyi'. A PROC PRINT is used to display the content of the combined dataset. Finally, PROC LIFETEST is executed to perform the survival analysis, comparing the survival curves of the two groups and generating graphs.
Data Analysis

Type : CREATION_INTERNE


The source data ('renyi1' and 'renyi2') are entirely created internally within the SAS script using DATA and CARDS statements. They represent survival data with an identifier, the number of survival days, and a censorship indicator.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates the 'renyi1' dataset by reading embedded raw data via a CARDS statement. It contains an identifier (id), survival days (days), and a censorship indicator (censor). The '@code_sas/@TEMPLATE.sas' part in the INPUT statement appears to be a syntax error or a remnant of an intention to include additional data or variables in a non-standard way, but is ignored when reading data via CARDS.
Copied!
1DATA renyi1;
2DO id=1 to 45;
3INPUT days censor @code_sas/@TEMPLATE.sas; OUTPUT;
4END;
5CARDS;
61 0 63 0 105 0 129 0 182 0 216 0 250 0 262 0 301 0 301 0 342 0 354 0
7356 0 358 0 380 0 383 0 383 0 338 0 394 0 408 0 460 0 489 0 499 0 523 0
8524 0 535 0 562 0 569 0 675 0 676 0 748 0 778 0 786 0 797 0 953 0 968 0
91000 0 1245 0 1271 0 1420 0 1551 0 1694 0 2363 0 2754 1 2950 1
10;
2 Code Block
DATA STEP
Explanation :
This DATA STEP block modifies the existing 'renyi1' dataset by adding a new 'group' variable with a value of 1 for all records. This identifies the first treatment group (chemotherapy).
Copied!
1DATA renyi1; SET renyi1; group=1;
3 Code Block
DATA STEP Data
Explanation :
Similar to the first block, this DATA STEP creates the 'renyi2' dataset from embedded raw data. It also contains an identifier, survival days, and a censorship indicator for the second treatment group. The same observation regarding the INPUT statement applies here.
Copied!
1DATA renyi2;
2DO id=1 to 45;
3INPUT days censor @code_sas/@TEMPLATE.sas; OUTPUT;
4END;
5CARDS;
617 0 42 0 44 0 48 0 60 0 72 0 74 0 95 0 103 0 108 0 122 0 144 0
7167 0 170 0 183 0 185 0 193 0 195 0 197 0 208 0 234 0 235 0 254 0 307 0
8315 0 401 0 445 0 464 0 484 0 528 0 542 0 547 0 577 0 580 0 795 0 855 0
91366 0 1577 0 2060 0 2412 1 2486 1 2796 1 2802 1 2934 1 2988 1
10;
4 Code Block
DATA STEP
Explanation :
This DATA STEP block adds the 'group' variable with a value of 2 to all records in the 'renyi2' dataset, thus identifying the second treatment group (chemotherapy + radiotherapy).
Copied!
1DATA renyi2; SET renyi2; group=2;
5 Code Block
DATA STEP Data
Explanation :
This DATA STEP combines (concatenates) the 'renyi1' and 'renyi2' datasets into a new dataset called 'renyi'. This prepares the data for comparative survival analysis.
Copied!
1DATA renyi; SET renyi1 renyi2;
6 Code Block
PROC PRINT
Explanation :
This PROC PRINT displays the content of the 'renyi' dataset in the output window, allowing for a quick verification of the combined data.
Copied!
1PROC PRINT;
7 Code Block
PROC LIFETEST
Explanation :
This PROC LIFETEST performs the survival analysis. It uses the non-parametric LIFE method to estimate the survival function. The 'plots=(s,h)' options request the generation of survival curves and cumulative hazard function. The 'time days*censor(1)' statement specifies that 'days' is the time variable and 'censor' is the event variable, where '1' indicates an event (death). The 'strata group' statement requests a separate survival analysis for each level of the 'group' variable, allowing for a comparison between treatment groups. The SYMBOL statements customize the appearance of the curves in the graphs.
Copied!
1PROC LIFETEST method=life DATA=renyi plots=(s,h) graphics;
2title 'Gastrointestinal Tumor Study Group (1982)';
3title2 'Gastric cancer survival: 1=chemotherapy vs 2=chemotherapy+radiotherapy';
4time days*censor(1);
5strata group;
6symbol1 v=none color=red line=1;
7symbol3 v=none color=black line=3;
8 
9 
10RUN;
8 Code Block
MACRO DEFINITION
Explanation :
This code block defines a SAS macro named 'TEMPLATE'. It is a template for creating new macros, including sections for documentation, modification history, usage, notes, parameters, and error handling. Although present in the referenced files, this macro is not called or executed by the main SAS script; it serves only as a definition or template.
Copied!
1/*=====================================================================
2Program Name : TEMPLATE.sas
3Purpose : PURPOSE OF THE MACRO
4SAS Version : SAS VERSION WHEN THE MACRO WAS ORIGINALLY WRITTEN
5Input Data : N/A
6Output Data : N/A
7 
8Macros Called : LIST ANY UTILITY MACROS CALLED BY THIS MACRO
9 SO THEY CAN BE ADDED TO THE SASAUTOS LIBRARY AS WELL
10 
11Originally Written by : YOUR FULL NAME (NOT INITIALS - MAKE IT EASY TO FIND YOU LATER)
12Date : TODAYs DATE IN DDMONYYYY FORMAT (INTERNATIONLALLY UNAMBIGUOUS DATE FORMAT)
13Program Version # : 1.0
14 
15=======================================================================
16 
17Copyright (c) 2016 Scott Bass (sas_l_739 @yahoo.com.au)
18 
19This code is licensed under the Unlicense license.
20For more information, please refer to http://unlicense.org/UNLICENSE.
21 
22=======================================================================
23 
24Modification History : Original version
25 
26Programmer : YOUR FULL NAME
27Date : DDMONYYYY
28Change/reason : SUMMARY OF CODE CHANGE.
29 ADD COMMENTS IN THE CODE ITSELF
30 (INCLUDING NAME AND DATE) FOR ADDITIONAL DETAILS)
31Program Version # : 1.1
32 
33Programmer : YOUR FULL NAME
34Date : DDMONYYYY
35Change/reason : SUMMARY OF CODE CHANGE.
36 ADD COMMENTS IN THE CODE ITSELF
37 (INCLUDING NAME AND DATE) FOR ADDITIONAL DETAILS)
38Program Version # : 1.2
39 
40VERSION 1.0 (ORIGINAL VERSION):
41 LEAVE "Original version" TEXT IN PLACE
42 DELETE REVISION HISTORY
43 
44VERSION 1.1+ (MODIFIED VERSION):
45 DELETE THE "Original version" TEXT
46 ADD THE REVISION HISTORY PER ABOVE TEMPLATE
47 
48=====================================================================*/
49 
50/*---------------------------------------------------------------------
51Usage:
52 
53LIST MACRO USE CASE / UNIT TESTS HERE
54TRY TO USE UNIVERSALLY AVAILABLE SOURCE DATA IF POSSIBLE
55(EG. SASHELP DATASETS, C:\WINDOWS, /USR/LOCAL, ETC.)
56OR ELSE CREATE SIMPLE TEST DATA INLINE
57SO THE END USER CAN RUN THE USE CASE WITHOUT FURTHER SETUP OR EFFORT.
58IDEALLY THE TEST CASES RUN BY HIGHLIGHTING THE TEXT IN THE SAS EDITOR
59AND HITTING F3
60 
61=======================================================================
62 
63ADDITIONAL USE CASE
64 
65=======================================================================
66 
67ADDITIONAL USE CASE
68 
69-----------------------------------------------------------------------
70Notes:
71 
72EXPLANATORY NOTES HERE, THAT EXPLAIN DESIGN DECISIONS OR
73GENERAL USAGE INFORMATION.
74 
75THESE ARE NOTES THAT GO BEYOND COMMENTS WITHIN THE MACRO CODE.
76 
77---------------------------------------------------------------------*/
78 
79%macro TEMPLATE
80/*---------------------------------------------------------------------
81PURPOSE OF THE MACRO (REDUNDANT BUT NICE TO HAVE HERE AS WELL)
82---------------------------------------------------------------------*/
83(PARM1 /* PARM1 EXPLANATION (REQ). */
84,PARM2=default /* PARM2 EXPLANATION (Opt). Default is "default" */
85);
86 
87%local macro parmerr _data_;
88%let macro = &sysmacroname;
89 
90%* check INPUT parameters ;
91%parmv(PARM1, _req=1,_words=1,_case=N) /* words allows ds options */
92%parmv(PARM2, _req=0,_words=0,_case=N)
93 
94%IF (&parmerr) %THEN %goto QUIT;
95 
96%* additional error checking ;
97%IF (&parm1 eq FOO and %superq(parm2) eq BAR) %THEN %DO;
98 %parmv(_msg=These two values are mutually exclusive)
99 %goto %QUIT;
100%END;
101 
102%* well commented macro code goes here ;
103 
104%* Use %* or /* */ comment style for comments that DO not show in MPRINT OUTPUT ;
105%* Use * comment style for comments that show in MPRINT OUTPUT ;
106 
107%QUIT:
108 
109%mend;
110 
111/******* END OF FILE *******/
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 : Copyright (c) 2016 Scott Bass (sas_l_739 @yahoo.com.au). This code is licensed under the Unlicense. For more information, please refer to http://unlicense.org/UNLICENSE.