Kaplan-Meierプロットに付加情報を追加するマクロの作成

Similar documents
Kaplan-Meierプロットに付加情報を追加するマクロの作成

SAS Enterprise Guideによるデータ解析入門

SAS Enterprise Guideによるデータ解析入門

7 / 70 8 / 70 SAS Enterprise Guide, Windows SAS, SAS,,,, SAS SAS Enterprise Guide SAS: SAS Enterprise Guide:, SAS SAS Enterprise Guide... 5 / 70 6 / 7

Microsoft PowerPoint - 【魚住】 発表原稿【Web公開用】.ppt [互換モード]

Microsoft PowerPoint - SAS2012_ZHANG_0629.ppt [互換モード]

*1 * Wilcoxon 2 2 t t t t d t M t N t M t n t N t n t N t d t N t t at ri

Presentation Title Goes Here

untitled

Slide 1

こんにちは由美子です

Copyright SATO International All rights reserved. This software is based in part on the work of the Independen

JMP V4 による生存時間分析

2 H23 BioS (i) data d1; input group patno t sex censor; cards;


Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for


untitled


Release Notes for JMP book

自分の天職をつかめ

Microsoft Word - StatsDirectMA Web ver. 2.0.doc

橡ボーダーライン.PDF

52-2.indb

1 2 3

untitled


13 Student Software TI-Nspire CX CAS TI Web TI-Nspire CX CAS Student Software ( ) 1 Student Software 37 Student Software Nspire Nspire Nspir

R Commanderを用いたデータ解析

Chapter

システム必要条件 - SAS Human Capital Mangement 5.1


Microsoft PowerPoint - 【配布・WEB公開用】SAS発表資料.pptx

Web Web Web Web Web, i

,,,,., C Java,,.,,.,., ,,.,, i

Chapter 1 Epidemiological Terminology


Microsoft Word - Win-Outlook.docx

JCPRG Annual Report No.4 (2014)

untitled

untitled

システム必要条件 - SAS Financial Mangement 5.1

IC IC IC IC IC IC IC IC V IC IC IC euphrates.andrew.ac.jp/ public / web / User / MOM / Syllabus / MOMwebGakuseiSyllabusSansho / UI / MOMwebWS

Microsoft Word - 【日本語】JLP様春16_Dorm Information.doc

Microsoft Word - D JP.docx

エレクトーンのお客様向けiPhone/iPad接続マニュアル

untitled

PFS-Readme

Compiled MODELSでのDFT位相検出装置のモデル化と評価

ProVAL Recent Projects, ProVAL Online 3 Recent Projects ProVAL Online Show Online Content on the Start Page Page 13


DS-30

NO

09‘o’–

VQT3B86-4 DMP-HV200 DMP-HV150 μ μ l μ

インターネット接続ガイド v110

02石出猛史.indd


システム必要条件 - SAS Web Analytics 5.3

日本製薬工業協会シンポジウム 生存時間解析の評価指標に関する最近の展開ー RMST (restricted mean survival time) を理解するー 2. RMST の定義と統計的推測 2018 年 6 月 13 日医薬品評価委員会データサイエンス部会タスクフォース 4 生存時間解析チー

ユーザーガイド

学術会議講演 pptx

展開とプロビジョニングの概念

基本操作ガイド

<91818C E90B690EA97708CF696B188F58D758DC0838A815B83742E706466>

VMware View Persona Management


操作ガイド(本体操作編)

1 1.1 PC PC PC PC PC workstation PC hardsoft PC PC CPU 1 Gustavb, Wikimedia Commons.

大学野球の期分けにおける一般的準備期のランニング トレーニングが試合期の大学生投手の実戦状況下 パフォーマンスに与える影響

12 1) Allison , Person-year Data 3 t


EP-704A



iPhone/iPad接続マニュアル

Release Notes.book


作業手順手引き

A B C B C ICT ICT ITC ICT

橡SPA2000.PDF

GENESYS2005_Instal_Guide.PDF

1 1) ) practical useful 1) Working Paper Series No ) Educational Value Practical Value


外国語学部 紀要30号(横書)/03_菊地俊一

Hohenegger & Schär, a cm b Kitoh et. al., Gigerenzer et. al. Susan et. al.

untitled

H22 BioS t (i) treat1 treat2 data d1; input patno treat1 treat2; cards; ; run; 1 (i) treat = 1 treat =

06_仲野恵美.indd

2 10 The Bulletin of Meiji University of Integrative Medicine 1,2 II 1 Web PubMed elbow pain baseball elbow little leaguer s elbow acupun

ネットワークビデオレコーダー VK-64/VK-16/VK-Lite v2.2 セットアップガイド

IPSJ SIG Technical Report Vol.2016-CE-137 No /12/ e β /α α β β / α A judgment method of difficulty of task for a learner using simple

生研ニュースNo.132

システム必要条件 - SAS Forecast Server 3.1


第122号.indd

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

ECCS. ECCS,. ( 2. Mac Do-file Editor. Mac Do-file Editor Windows Do-file Editor Top Do-file e

How to read the marks and remarks used in this parts book. Section 1 : Explanation of Code Use In MRK Column OO : Interchangeable between the new part

SAS Campaign Management 5.4 システム必要条件

Transcription:

Kaplan-Meier 1, 2,3 1 2 3 A SAS macro for extended Kaplan-Meier plots Kengo Nagashima 1, Yasunori Sato 2,3 1 Department of Parmaceutical Technochemistry, Josai University 2 School of Medicine, Chiba University 3 Department of Biostatistics, Harvard School of Public Health ( Kaplan-Meier ) (log-rank P ) Kaplan-Meier SAS 9.2 LIFETEST Procedure ODS Graph SAS 9.1.3 Kaplan-Meier SAS GPLOT Procedure annotate option ( log-rank P ) SAS 9.2 ODS Graph Kaplan-Meier plot; Number at risk; LIFETEST Procedure; GPLOT Procedure; ODS Graph; TEMPLATE Procedure 1 %km_data() SAS 9.2 7 8 1.1 (Ver 2.1.1) 1. (log-rank test, Wilcoxon test, Likelihood ratio test)cox 2. 3. %km_data() GPLOT Procedure annotate option ( ) 1

1: %km_data() data Base 0 time [data] Step stra [data] Label censor [data] Test (0:, 1: ) censorv [censor] TestX ( ) 100 ( ) out TestY ( ) 100 ( ) anno annotate Type (logrank: log-rank test, wilcoxon: generalized wilxocon test, CI (0:, 1: ) likelihoodratio: likelihood ratio test) HR (0:, 1: ) param = ref ref = first censext (0:, 1: ) HRX ( ) cheight HRY ( ) cwidth MST 95% (0:, 1: ) Size MlabX () afont MmedX () atrisk (0: MciX 95%, 1: ) () atriskorder MSTY () data step n [out] SV1 SVn SL1 SLn, SU1 SUn CSDF1 CSDFn color1 colorn ( ), scolor1 scolorn () [out] annotate [anno] GPLOT Procedure SAS 9.2 SAS 9.1.3 1.2 %km_data() ODS Graph 1 1 SAS 12 pt

SL1 SLn, SU1 SUn CSDF1 CSDFn plot statement symbol statement ( Web ) 1: %km_data() / * C o l o r s e t t i n g * / % g l o b a l c o l o r 1 c o l o r 2 c o l o r 3 s c o l o r 1 s c o l o r 2 s c o l o r 3 ; % l e t c o l o r 1 = c x 4 4 5 6 9 4 ; % l e t c o l o r 2 = c x A 2 3 A 2 E ; % l e t c o l o r 3 = c x 0 1 6 6 5 E ; % l e t s c o l o r 1 = c x D 4 D 9 E 8 ; % l e t s c o l o r 2 = c x F 1 C E C E ; % l e t s c o l o r 3 = c x D 1 E 4 E 3 ; / * CI: fill, Censor: needle, Atrisk: show, Logrank test, Hazardratio * / % k m _ d a t a ( D1, T, GroupC, Censor, 1, out = graph, anno = anno, C I = 1, c e n s E X T = 1, S i z e = 2, atrisk = 1, atriskorder = 0 to 12.5 by 2.5, Step = 5, Label = "No. at risk (1st entry: high, 2nd: middle, 3rd: low)", Test = 1, TestX = 98, TestY = 97, Type = logrank, H R = 1, H R X = 98, H R Y = 9 2 / * G r a p h o u t p u t s e t t i n g * / g o p t i o n s r e s e t = a l l ; g o p t i o n s v s i z e = 1 2 i n h s i z e = 1 9 i n h t i t l e = 3. 5 h t e x t = 3. 5 ; o p t i o n s l i n e s i z e = 9 8 p a g e s i z e = 2 0 0 ; f i l e n a m e g r a f o u t " & P a t h. k m _ d a t a. e m f " ; g o p t i o n s d e v i c e = e m f g s f n a m e = g r a f o u t g s f m o d e = r e p l a c e ; g o p t i o n s f t e x t = " T i m e s N e w R o m a n " ; p r o c g p l o t d a t a = G r a p h ; p l o t ( S v 1 S v 2 S v 3 ) * T / a n n o = a n n o / * a u t o v r e f c a u t o v r e f = c x E 9 D E C A * / o v e r l a y s k i p m i s s n o f r a m e l e g e n d = l e g e n d 1 h a x i s = a x i s 1 v a x i s = a x i s 2 ; a x i s 1 l a b e l = ( 'M o n t h s a f t e r e n t r y ') m a j o r = ( w = 2 h e i g h t = 0. 7 ) w = 2 m i n o r = n o n e o r d e r = ( 0 t o 1 2. 5 b y 2. 5 ) o f f s e t = (2, 7 a x i s 2 l a b e l = ( a = 9 0 'P r o p o r t i o n o f o v e r a l l s u r v i v a l ') m a j o r = ( w = 2 h e i g h t = 1 ) w = 2 m i n o r = n o n e o r d e r = ( 0 t o 1 b y 0. 2 ) o f f s e t = (2, 2 l e g e n d 1 l a b e l = n o n e p o s i t i o n = ( i n s i d e ) m o d e = p r o t e c t o r i g i n = (4, 1. 5 ) value = ( h = 2 " high - risk" " middle - risk" " low - risk"); s y m b o l 1 i = s t e p l j c = " & c o l o r 1. " w = 5 ; s y m b o l 2 i = s t e p l j c = " & c o l o r 2. " w = 5 ; s y m b o l 3 i = s t e p l j c = " & c o l o r 3. " w = 5 ; q u i t ;

Proportion of overall survival 1.0 0.8 0.6 0.4 0.2 0.0 Log-rank P = 0.030 2:middle-risk HR = 0.611 [0.359, 1.038] 3:low-risk HR = 0.502 [0.289, 0.871] No. at risk (1st entry: high, 2nd: middle, 3rd: low) 50 36 28 23 15 0 50 42 36 30 25 0 50 44 36 32 26 0 0.0 2.5 5.0 7.5 10.0 12.5 high-risk middle-risk low-risk Months after entry 1: 1 (%km_data() ) 2: 2 (SAS 9.2 ODS Graph) 2 LIFETEST Procedure (SAS 9.2) 2.1 ODS Graph SAS 9.2 ODS Graph LIFETEST Procedure SAS 9.1.3 %km_data() ODS Graph 2 2

2: ODS Graph o d s l i s t i n g g p a t h = " & P a t h. " s t y l e = S t a t i s t i c a l s g e = o n ; o d s g r a p h i c s o n / a n t i a l i a s = o n b o r d e r = o f f s c a l e = o n i m a g e n a m e = " L i f e t e s t _ o d s " w i d t h = 6. 3 3 3 3 3 3 3 3 i n h e i g h t = 4 i n ; p r o c l i f e t e s t d a t a = D 1 p l o t s = ( s u r v i v a l ( a t r i s k = ( 0 t o 1 2. 5 b y 2. 5 ) t e s t c l ) t i m e T * C e n s o r ( 1 s t r a t a G r o u p C ; o d s g r a p h i c s o f f ; o d s l i s t i n g c l o s e ; o d s l i s t i n g ; ODS Graph ODS LISTING statement sge = on sge ODS Graphics Editor TEMPLATE Procedure SAS 9.2 TS2M0 ODS Graph ODS Graph 2.2 TEMPLATE Procedure 3 TEMPLATE Procedure 4 5 6 3: p r o c t e m p l a t e ; s o u r c e S t a t. L i f e t e s t. G r a p h i c s. P r o d u c t L i m i t S u r v i v a l ; 4: p r o c t e m p l a t e ; d e f i n e s t y l e S t y l e s. M y S t a t i s t i c a l ; p a r e n t = s t y l e s. S t a t i s t i c a l ; s t y l e G r a p h F o n t s / 'G r a p h T i t l e F o n t '= ( "Times N e w R o m a n ",24pt, b o l d ) 'G r a p h F o o t n o t e F o n t '= ( "Times N e w R o m a n ",24pt, i t a l i c ) 'G r a p h L a b e l F o n t '= ( "Times N e w R o m a n ",24p t ) 'G r a p h V a l u e F o n t '= ( "Times N e w R o m a n ", 2 4 p t ) 'G r a p h D a t a F o n t '= ( "Times N e w R o m a n ", 2 4 p t ) 'GraphUnicodeFont '= ( " <MTsans -serif -unicode> ", 24pt) 'G r a p h A n n o F o n t '= ( "Times N e w R o m a n ", 2 4 p t d e f i n e s t a t g r a p h S t a t. L i f e t e s t. G r a p h i c s. P r o d u c t L i m i t S u r v i v a l ; i f ( P L O T A T R I S K = 1 ) i n n e r m a r g i n / a l i g n = b o t t o m ; b l o c k p l o t x = T A T R I S K b l o c k = A T R I S K / r e p e a t e d v a l u e s = t r u e d i s p l a y = ( v a l u e s ) v a l u e h a l i g n = s t a r t v a l u e f i t p o l i c y = t r u n c a t e l a b e l p o s i t i o n = l e f t l a b e l a t t r s = G R A P H V A L U E T E X T v a l u e a t t r s = G R A P H D A T A T E X T ( s i z e = 2 0 p t ) i n c l u d e m i s s i n g c l a s s = f a l s e ; o d s l i s t i n g g p a t h = " & P a t h. " s t y l e = M y S t a t i s t i c a l s g e = o n ; o d s g r a p h i c s o n / b o r d e r = o f f s c a l e = o n i m a g e n a m e = " L i f e t e s t _ o r i g i n a l _ o d s " h e i g h t = 1 2 i n w i d t h = 1 9 i n ; p r o c l i f e t e s t d a t a = D 1 p l o t s = ( s u r v i v a l ( a t r i s k = ( 0 t o 1 2. 5 b y 2. 5 ) t e s t c l ) t i m e T * C e n s o r ( 1 s t r a t a G r o u p C 2 ; o d s g r a p h i c s o f f ; o d s l i s t i n g c l o s e ; o d s l i s t i n g ;

3: 4 (SAS 9.2 ODS Graph ) 5: p r o c t e m p l a t e ; d e l e t e S t a t. L i f e t e s t. G r a p h i c s. P r o d u c t L i m i t S u r v i v a l ; 6: o d s p a t h s a s h e l p. t m p l m s t ( r e a d p r o c d a t a s e t s l i b r a r y = s a s u s e r ; d e l e t e t e m p l a t ( m e m t y p e = i t e m s t o r o d s p a t h s a s u s e r. t e m p l a t ( u p d a t e ) s a s h e l p. t m p l m s t ( r e a d 3 %km_data() ODS Graph Kaplan-Meier %km_data() %km_data() 4 Web (http://www.josai.ac.jp/~nagasima/) (GPLv3; http://www.gnu.org/licenses/) [1] SAS Institute Inc. SAS 9.2 Macro Language: Reference. Cary, NC, USA: SAS Institute Inc., 2009. [2] SAS Institute Inc. SAS/STAT(R) 9.2 User s Guide, Second Edition. Cary, NC, USA: SAS Institute Inc., 2009. [3] SAS Institute Inc. SAS/GRAPH(R) 9.2: Graph Template Language User s Guide, Second Edition. Cary, NC, USA: SAS Institute Inc., 2008.

Proportion of overall survival 1.0 0.8 0.6 0.4 0.2 0.0-2Log(LR) P = 0.029 2:middle-risk HR = 0.611 [0.359, 1.038] 3:low-risk HR = 0.502 [0.289, 0.871] Proportion of overall survival 1.0 0.8 0.6 0.4 0.2 0.0 Wilcoxon P = 0.032 No. at risk (1st entry: high, 2nd: middle, 3rd: low) 50 36 28 23 15 0 50 42 36 30 25 0 50 44 36 32 26 0 0.0 2.5 5.0 7.5 10.0 12.5 high-risk middle-risk low-risk Months after entry 0.0 2.5 5.0 7.5 10.0 12.5 high-risk middle-risk low-risk Months after entry 1.0 Log-rank P = 0.067 Proportion of overall survival 1.0 0.8 0.6 0.4 0.2 0.0 high-risk low-risk No. at risk (1st entry: high, 2nd: middle, 3rd: low) 50 36 28 23 15 0 50 42 36 30 25 0 50 44 36 32 26 0 0.0 2.5 5.0 7.5 10.0 12.5 middle-risk Months after entry MST 95% C.I. 1: high-risk 7.8 [4.4, 9.0) 2: middle-risk 11.3 [6.7,.) 3: low-risk. [8.2,.) Proportion of overall survival 0.8 0.6 0.4 0.2 0.0 No. at risk (1st entry: high, 2nd: middle) 50 36 28 23 15 0 50 42 36 30 25 0 0.0 2.5 5.0 7.5 10.0 12.5 high-risk middle-risk Months after entry 4: (%km_data() ) A,, 7: o p t i o n l i n e s i z e = 2 0 0 p a g e s i z e = 5 0 0 0 m p r i n t ; d m 'l o g ; c l e a r ; o u t p u t ; c l e a r ; '; / * s e t t i n g p a t h * / % l e t e x e c p a t h = " " ; % l e t P a t h = " " ; % m a c r o s e t e x e c p a t h ; % l e t e x e c p a t h = % s y s f u n c ( g e t o p t i o n ( s y s i n ) % i f % l e n g t h ( & e x e c p a t h ) = 0 % t h e n % l e t e x e c p a t h = % s y s g e t ( s a s _ e x e c f i l e p a t h d a t a _ n u l l _ ; d o i = l e n g t h ( " & e x e c p a t h " ) t o 1 b y -1; i f s u b s t r ( " &execpath", i, 1 ) = " \ " t h e n d o ; c a l l s y m p u t ( "Path", s u b s t r ( " &execpath", 1, i ) s t o p ; % m e n d s e t e x e c p a t h ; % s e t e x e c p a t h ; l i b n a m e O u t " & P a t h " ; d a t a D 1 ; l e n g t h G r o u p C $ 2 0. ; c a l l s t r e a m i n i t ( 3 2 7 8 9 2 3 8 t c = 1 2 ; / * w i t h d r a w a l t i m e * / h 1 = 0. 1 0 0 ; n 1 = 5 0 ; / * h 1 : h a z a r d o f g r o u p 1 * / h 2 = 0. 0 7 5 ; n 2 = 5 0 ; / * h 2 : h a z a r d o f g r o u p 2 * / h 3 = 0. 0 5 0 ; n 3 = 5 0 ; / * h 3 : h a z a r d o f g r o u p 3 * / / * E ( T ) = 1 / h * / a r r a y h [ * ] h1 - h 3 ; a r r a y n [ * ] n1 - n 3 ; d o G r o u p = 1 t o 3 ; d o i = 1 t o n [ g r o u p ] ; T = r a n d ( 'e x p o n e n t i a l ') / h [group]; C e n s o r = 0 ; i f T > t c t h e n d o ; T = t c ; C e n s o r = 1 ;

i f r a n d ( 'U n i f o r m ') > 0.9 t h e n d o ; C e n s o r = 1 ; / * lost to follow - up ( random) * / if Group = 1 then GroupC = '1 : high - risk '; if Group = 2 then GroupC = '2 : middle - risk '; i f G r o u p = 3 t h e n G r o u p C = '3 : low - r i s k '; o u t p u t ; l a b e l T = " M o n t h s a f t e r e n t r y " ; k e e p T C e n s o r G r o u p G r o u p C ; 8: %km_data() / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright ( C ) 2010, Kengo NAGASHIMA. T h i s p r o g r a m i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f M E R C H A N T A B I L I T Y o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E. S e e t h e G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s. Y o u s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e a l o n g w i t h t h i s p r o g r a m. I f not, s e e <h t t p : / /www.gnu.org/licenses/ > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * M a c r o n a m e : % k m d a t a ( ) A u t h o r : K e n g o N A G A S H I M A V e r s i o n : 2. 1. 3 L a s t U p d a t e d D a t e : 0 7 / 0 9 / 2 0 1 0 S y s t e m R e c o m m e n d s : Windows XP 32 bit, SAS 9.2, s e t u p S A S o u t p u t f i n t s i z e = 1 2 p t S y s t e m R e q u i r e m e n t s : Windows XP / Vista / 7, SAS 9. 1. 3 or later, Base SAS, SAS/STAT, SAS/GRAPH * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Make graph datasets for extended Kaplan - Meier plots d a t a : a i n p u t d a t a s e t n a m e t i m e : a s u r v i v a l t i m e v a r i a b l e n a m e s t r a : a s t r a t u m v a r i a b l e n a m e c e n s o r : a c e n s o r v a r i a b l e n a m e c e n s o r v : c e n s o r e d v a r i a b l e c o d e o u t : o u t p u t g r a p h d a t a s e t n a m e a n n o : o u t p u t a n n o t a t e d a t a s e t n a m e a f o n t : n o. a t r i s k t e x t f o n t C I : 0 = n o n e 1 = s h o w c o n f i d e n c e i n t e r v a l P a t t e r n : c o n f i d e n c e i n t e r v a l f i l l i n g p a t t e r n s e e [ A n n o t a t e D i c t i o n a r y S T Y L E V a r i a b l e ] c e n s E X T : 0 = n o n e 1 = c e n s o r e x t e n s i o n ( n e e d l e ) c H e i g h t : e x t e n d e d c e n s o r h e i g h t c W i d t h : e x t e n d e d c e n s o r w i d t h Size: font size of at risk, test and hazard ratio Step: at risk, MST & HR interval step size a t r i s k : 0 = n o n e 1 = n o. a t r i s k a t r i s k o r d e r : n o. a t r i s k o r d e r B a s e : a t r i s k b a s e p o s i t i o n L a b e l : a t r i s k l a b e l T e s t : 0 = n o n e 1 = s h o w h o m o g e n e i t y t e s t T e s t X : = x p o s i t i o n ( % o f d a t a a r e a ) T e s t Y : = y p o s i t i o n ( % o f d a t a a r e a ) T y p e : l o g r a n k = log - r a n k t e s t w i l c o x o n = g e n e r a l i z e d w i l x o c o n t e s t l i k e l i h o o d r a t i o = l i k e l i h o o d r a t i o t e s t H R : 0 = n o n e 1 = s h o w h a z a r d r a t i o H R X : x p o s i t i o n ( % o f d a t a a r e a ) H R Y : y p o s i t i o n ( % o f d a t a a r e a ) M S T : 0 = n o n e 1 = s h o w m e d i a n s u r v i v a l t i m e M l a b X : x p o s i t i o n o f s t r a t a l a b e l ( % o f d a t a a r e a ) M m e d X : x p o s i t i o n o f m e d i a n ( % o f d a t a a r e a ) M c i X : x p o s i t i o n o f c o n f i d e n c e i n t e r v a l ( % o f d a t a a r e a ) M S T Y : y p o s i t i o n ( % o f d a t a a r e a ) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / % m a c r o k m _ d a t a ( data, time, stra, censor, censorv, out = graph, anno = anno, C I = 0, P a t t e r n = x4, censext = 0, cheight = 0.025, cwidth = 5, S i z e = 3, S t e p = 4, a f o n t = " 'T i m e s N e w R o m a n '",

a t r i s k = 0, a t r i s k o r d e r = 0 t o 0, B a s e = 0, L a b e l = "No. a t r i s k ", Test = 0, TestX = 90, TestY = 100, Type = logrank, H R = 0, H R X = 90, H R Y = 95, M S T = 0, M l a b X = 60, M m e d X = 80, M c i X = 98, M S T Y = 9 5 % i f " & s t r a. " = " " % t h e n % d o ; % l e t s t r a = d s t r a ; d a t a & d a t a. ; s e t & d a t a. ; d s t r a = 1 ; % o d s e x c l u d e a l l ; p r o c l i f e t e s t d a t a = & d a t a. o u t s u r v = & o u t. ; t i m e & t i m e. * & c e n s o r. ( & c e n s o r v. s t r a t a & s t r a. ; o d s o u t p u t H o m T e s t s = T e s t C e n s o r e d S u m m a r y = C S P r o d u c t L i m i t E s t i m a t e s = P L E Q u a r t i l e s = Q E S T ; % i f " & s y s v e r. " = " 9. 2 " % t h e n p r o c p h r e g ; % e l s e % i f " & s y s v e r. " = " 9. 1 " % t h e n p r o c t p h r e g ; d a t a = & d a t a. ; c l a s s & s t r a. / p a r a m = r e f r e f = f i r s t ; m o d e l & t i m e. * & c e n s o r. ( & c e n s o r v. ) = & s t r a. / r l ; o d s o u t p u t P a r a m e t e r E s t i m a t e s = H a z a r d R a t i o ; o d s s e l e c t a l l ; p r o c s o r t d a t a = & o u t. ; b y & s t r a. ; s e t & o u t. ; r e t a i n C S D F 0 ; i f S u r v i v a l =. t h e n S u r v i v a l = C S D F ; e l s e C S D F = S u r v i v a l ; d r o p & s t r a. ; s e t & o u t. ( w h e r e = ( _ C E N S O R _ ^ = 1 ) d r o p = C S D F ) & o u t. ( w h e r e = ( _ C E N S O R _ = 1 ) d r o p _ C E N S O R _ ; p r o c s o r t d a t a = & o u t. ; b y & t i m e. ; d a t a _ n u l l _ ; s e t C S (where=(control_var^=" -")); c a l l s y m p u t ( " S t r a N ", c a t ( _ N _ ) m e r g e & o u t. ( w h e r e = ( S T R A T U M = & i. ) r e n a m e = ( S u r v i v a l = S V & i. S D F _ L C L = S L & i. S D F _ U C L = S U & i. ) d r o p = C S D F ) & o u t. ( w h e r e = ( S T R A T U M = & i. & C S D F & i. ^ =. ) r e n a m e = ( C S D F = C S D F & i. S D F _ L C L = S L & i. S D F _ U C L = S U & i. ) d r o p = S u r v i v a l ) % ; b y & t i m e. ; d r o p S T R A T U M ; p r o c s o r t d a t a = & o u t. ; b y & t i m e. ; / * C e n s o r e x t e n s i o n * / % i f " & c e n s E X T. " = " 1 " % t h e n % k m _ c e n s E X T ( & o u t., & t i m e., & S t r a N., & c H e i g h t., & c W i d t h., c e n s / * N o. a t r i s k * / % i f " & a t r i s k. " = " 1 " % t h e n %km_atrisk(ple, &stra., &time., &StraN., & a t r i s k o r d e r., & B a s e., & S t e p., & S i z e., & l a b e l., &afont., a t r i s k / * H o m o g e n e i t y t e s t * / % i f " & T e s t. " = " 1 " % t h e n %km_homtest(test, &TestX., &TestY., &Type., & S i z e., & a f o n t., H T E S T / * H a z a r d r a t i o * / % i f " & H R. " = " 1 " % t h e n %km_hr(hazardratio, &HRX., &HRY., &StraN., &Step., & S i z e., & a f o n t., H R / * C o n f i d e n c e i n t e r v a l * / % i f " & C I. " = " 1 " % t h e n % k m _ c i ( & o u t., & t i m e., & S t r a N., & P a t t e r n., C I / * Q u a n t i l e e s t i m a t e * / % i f " & M S T. " = " 1 " % t h e n % k m _ q e s t ( QEST, & s t r a., & M l a b X., & M m e d X., & M c i X., & M S T Y., & S t r a N., & S t e p., & S i z e., & a f o n t., Q E % i f % e v a l ( & c e n s E X T. + & a t r i s k. + & t e s t. + & h r. + & c i. ) ^ = 0 % t h e n % d o ; d a t a & a n n o. ; l e n g t h w h e n $ 1. s t y l e $ 3 0. ; s e t % i f & C I. = 1 % t h e n C I ; % i f & c e n s E X T. = 1 % t h e n c e n s ; % i f & a t r i s k. = 1 % t h e n a t r i s k ; % i f & t e s t. = 1 % t h e n H T E S T ; % i f & h r. = 1 % t h e n H R ; % i f & M S T. = 1 % t h e n Q E ; ; r e t a i n w h e n 'B '; % p r o c d a t a s e t s l i b = w o r k ; d e l e t e C S P L E Q E S T H a z a r d R a t i o T e s t % i f & C I. = 1 % t h e n C I ;

% i f & c e n s E X T. = 1 % t h e n c e n s ; % i f & a t r i s k. = 1 % t h e n a t r i s k ; % i f & t e s t. = 1 % t h e n H T E S T ; % i f & h r. = 1 % t h e n H R ; % i f & M S T. = 1 % t h e n Q E ; ; q u i t ; % m e n d k m _ d a t a ; / * c e n s o r e x t e n s i o n * / % m a c r o k m _ c e n s E X T ( data, time, StraN, cheight, cwidth, out d a t a _ n u l l _ ; s e t & d a t a. ; % i f " & S t r a N. " = " 1 " % t h e n c a l l s y m p u t ( " e x h t ", & c H e i g h t. * ( 1 - C S D F 1 ) % e l s e c a l l s y m p u t ( "exht", &cheight. * (1 - m i n ( o f C S D F 1 - C S D F & S t r a N. ) ) ; l e n g t h c o l o r f u n c t i o n $ 1 0. ; r e t a i n x s y s y s y s '2 ' s i z e & c W i d t h. ; s e t & d a t a. ; i f C S D F & i. ^ =. t h e n d o ; c o l o r = " & & c o l o r & i. " ; f u n c t i o n = 'm o v e '; x = & t i m e. ; y = C S D F & i. ; o u t p u t ; f u n c t i o n = 'd r a w '; x = & t i m e. ; y = C S D F & i. + & e x h t. ; o u t p u t ; % k e e p x s y s y s y s s i z e c o l o r f u n c t i o n x y ; % m e n d k m _ c e n s E X T ; / * N o. a t r i s k * / % m a c r o k m _ a t r i s k ( data, stra, time, StraN, order, base, step, size, label, afont, out s e t & d a t a. ; b y S T R A T U M & t i m e. ; d o x = & o r d e r. ; i f & t i m e. = 0 & C e n s o r =. t h e n d o ; l e a v e ; i f & t i m e. < x t h e n d o ; l e a v e ; l e n g t h c o l o r f u n c t i o n $ 1 0. ; s e t & o u t. ; b y S T R A T U M x ; r e t a i n x s y s '2 ' y s y s '1 ' c o l o r 'b l a c k ' p o s i t i o n '3 ' f u n c t i o n 'l a b e l ' s i z e & s i z e. ; % d o i = & S t r a N. % t o 1 % b y -1; i f S T R A T U M = & i. t h e n y = ( & b a s e. + & s t e p. * ( & S t r a N. - 1 ) ) - & s t e p. * ( & i. - 1 % t e x t = c a t ( L e f t i f l a s t. x t h e n o u t p u t ; d a t a d u m m y ; l e n g t h c o l o r f u n c t i o n $ 1 0. ; r e t a i n x s y s '2 ' y s y s '1 ' c o l o r 'b l a c k ' p o s i t i o n '3 ' f u n c t i o n 'l a b e l ' s i z e & s i z e. ; d o S T R A T U M = 1 t o & S t r a N. ; d o x = & o r d e r. ; % d o i = & S t r a N. % t o 1 % b y -1; i f S T R A T U M = & i. t h e n y = ( & b a s e. + & s t e p. * ( & S t r a N. - 1 ) ) - & s t e p. * ( & i. - 1 % o u t p u t ; m e r g e d u m m y & o u t. ; b y S T R A T U M x ; f o r m a t x t e x t $ 2 0. ; r e t a i n x t e x t ' '; i f t e x t ^ = " " t h e n x t e x t = t e x t ; e l s e t e x t = x t e x t ; d a t a L a b e l ; l e n g t h c o l o r f u n c t i o n $ 1 0. t e x t $ 1 0 0. ; r e t a i n x s y s '2 ' y s y s '1 ' c o l o r 'b l a c k ' p o s i t i o n '3 ' f u n c t i o n 'l a b e l ' s i z e & s i z e. ; x = 0 ; y = & b a s e. + & s t e p. * & S t r a N. ; t e x t = & l a b e l. ; o u t p u t ; s e t & o u t. L a b e l ; r e t a i n s t y l e & a f o n t. ; k e e p x s y s y s y s c o l o r p o s i t i o n f u n c t i o n s i z e x y t e x t s t y l e ; p r o c d a t a s e t s l i b = w o r k ; d e l e t e d u m m y L a b e l ; % m e n d k m _ a t r i s k ; / * h o m o g e n e i t y t e s t * / % m a c r o k m _ h o m t e s t ( Test, TestX, TestY, Type, Size, afont, out % i f " & T y p e " = " l o g r a n k " % t h e n s e t & T e s t. ( f i r s t o b s = 1 o b s = 1 % e l s e % i f " & T y p e " = " w i l c o x o n " % t h e n s e t & T e s t. ( f i r s t o b s = 2 o b s = 2 % e l s e % i f " & T y p e " = " l i k e l i h o o d r a t i o " % t h e n s e t & T e s t. ( f i r s t o b s = 3 o b s = 3 ;

r e t a i n x s y s '1 ' y s y s '1 ' c o l o r 'b l a c k ' p o s i t i o n '7 ' f u n c t i o n 'l a b e l ' s i z e & s i z e. s t y l e & a f o n t. ; x = & T e s t X. ; y = & T e s t Y. ; % i f " & T y p e " = " l o g r a n k " % t h e n text = cat("log -rank P = ", put(probchisq, PVALUE5.4)); % e l s e % i f " & T y p e " = " w i l c o x o n " % t h e n text = cat("wilcoxon P = ", put(probchisq, PVALUE5.4)); % e l s e % i f " & T y p e " = " l i k e l i h o o d r a t i o " % t h e n text = cat(" -2Log(LR) P = ", put(probchisq, PVALUE5.4));; k e e p x s y s y s y s c o l o r p o s i t i o n f u n c t i o n s i z e s t y l e x y t e x t ; % m e n d k m _ h o m t e s t ; / * h a z a r d r a t i o * / % m a c r o k m _ h r ( HazardRatio, HRX, HRY, StraN, Step, Size, afont, out s e t & H a z a r d R a t i o. ; l e n g t h t e x t $ 2 0 0. ; r e t a i n x s y s '1 ' y s y s '1 ' c o l o r 'b l a c k ' p o s i t i o n '7 ' f u n c t i o n 'l a b e l ' s i z e & s i z e. s t y l e & a f o n t. ; x = & H R X. ; y = & H R Y. - & S t e p. * ( _ n _ - 1 t e x t = c a t ( c o m p r e s s (ClassVal0), " H R = ", c o m p r e s s ( p u t ( HazardRatio, 8.3)), " [", c o m p r e s s ( p u t ( HRLowerCL, 8.3)), ", ", compress(put(hruppercl, 8.3)), " ] " k e e p x s y s y s y s c o l o r p o s i t i o n f u n c t i o n s i z e s t y l e x y t e x t ; % m e n d k m _ h r ; / * c o n f i d e n c e i n t e r v a l * / % m a c r o k m _ c i ( ConfidenceInterval, time, StraN, pattern, out d a t a & o u t. & i. ; l e n g t h c o l o r f u n c t i o n $ 1 0. ; r e t a i n x s y s y s y s '2 ' s t y l e " & p a t t e r n. " l i n e 0 t m p. ; s e t & C o n f i d e n c e I n t e r v a l. ( f i r s t o b s = 2 w h e r e S L & i. ^ =. ; c o l o r = " & & s c o l o r & i. " ; f u n c t i o n = 'b a r '; x = & t i m e. ; y = t m p ; o u t p u t ; t m p = S U & i. ; f u n c t i o n = 'm o v e '; x = & t i m e. ; y = S L & i. ; o u t p u t ; k e e p x s y s y s y s s t y l e l i n e c o l o r f u n c t i o n x y ; % s e t & o u t. & i. ( f i r s t o b s = 2 ) % ; p r o c d a t a s e t s l i b = w o r k ; d e l e t e & o u t. & i. ; % ; % m e n d k m _ c i ; / * Q u a n t i l e e s t i m a t e + 9 5 % C I * / % m a c r o k m _ q e s t ( Est, stra, MlabX, MmedX, MciX, MSTY, StraN, Step, Size, afont, out l e n g t h t e x t $ 2 0 0. ; s e t & E s t. ; r e t a i n x s y s '1 ' y s y s '1 ' c o l o r 'b l a c k ' f u n c t i o n 'l a b e l ' s i z e & s i z e. s t y l e & a f o n t. ; i f ( S T R A T U M = & i. & P e r c e n t = 5 0 ) t h e n d o ; p o s i t i o n = '4 '; % i f " & i. " = " 1 " % t h e n % d o ; x = & M m e d X. ; y = & M S T Y. ; t e x t = " M S T " ; o u t p u t ; x = & M c i X. ; y = & M S T Y. ; t e x t = " 9 5 % C. I. " ; o u t p u t ; % y = & M S T Y. - & S t e p. * & i. ; x = & MmedX.; text = put(estimate, 6. 1 output; x = & M c i X. ; text = cat("[", compress(put(lowerlimit, 6.1)), ", ", c o m p r e s s ( p u t ( UpperLimit, 6.1)), " ) " o u t p u t ; p o s i t i o n = '6 '; x = & M l a b X. ; t e x t = t r i m ( & s t r a. o u t p u t ; % k e e p x s y s y s y s c o l o r p o s i t i o n f u n c t i o n s i z e s t y l e x y t e x t ; % m e n d k m _ q e s t ;