NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.4 (TS1M7) Licensed to COLORADO PREVENTION CENTER, Site 70237720. NOTE: This session is executing on the X64_DSRV19 platform. NOTE: Analytical products: SAS/STAT 15.2 SAS/IML 15.2 NOTE: Additional host information: X64_DSRV19 WIN 10.0.17763 Server NOTE: SAS initialization used: real time 0.73 seconds cpu time 0.59 seconds 1 Options MPRINT; 2 ****************************************************************; 3 4 %macro SURV_CONTNRI(DSNAME,DETAIL,EVENT,PYRS,T,PROB1,PROB2); 5 * Macro to compute NRI with any up or down (no categories); 6 * Variables: 7 * DSNAME = dataset name; 8 * DETAIL = 2 for detailed printout, 1 for limited, 0 for none; 9 * EVENT = outcome variable (coded 0,1); 10 * PYS = follow-up time; 11 * T = time of predicted risk (eg., 10 years) = scalar; 12 * PROB1 = probability for model 1; 13 * PROB2 = probability for model 2; 14 *** NOTE: data need to be bootstrapped to get correct SE; 15 16 title2 Continuous NRI for Event &EVENT at Time &T : &PROB2 vs &PROB1 ; 17 title3 "Need to Bootstrap for SE"; 18 19 data nri1; set &dsname; 20 _id_=_N_; 21 * compute diffs in probs; 22 event=&EVENT; 23 pyrs=&pyrs; 24 prob1=&PROB1; 25 prob2=&PROB2; 26 diffp=prob2-prob1; 27 if prob1>. and prob2>.; 28 keep _id_ event pyrs prob1 prob2 diffp; 29 run; 30 31 data nri1; set nri1; 32 if prob2>prob1 then disc=1; 33 else if prob2=prob1 then disc=0; 34 else if prob20 %then %do; 168 proc print data=_all_; 169 var totn ecase econt inc_all n_up n_same n_down inc_up inc_down 170 pup_case pdown_case pup_cont pdown_cont 171 ri_case ri_contr nri evri_case evri_contr evnri esenri enricil enriciu 172 ezri_case ezri_contr eznri ep2ri_case ep2ri_contr ep2nri 173 ; 174 run; 175 %end; 176 title2; run; 177 * Usage: 178 * %surv_contnri(probs,1,outxy,pyrs,10,pdx,pdxy); 179 %exit: %mend SURV_CONTNRI; 180 181 ****************************************************************; 182 183 184 ****************************************************************; 185 proc import datafile="C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv" 186 out=newdata 187 dbms=csv 188 replace; 189 run; Name "" is not a valid SAS name. Problems were detected with provided names. See LOG. 190 /********************************************************************** 191 * PRODUCT: SAS 192 * VERSION: 9.4 193 * CREATOR: External File Interface 194 * DATE: 09JUL24 195 * DESC: Generated SAS Datastep Code 196 * TEMPLATE SOURCE: (None Specified.) 197 ***********************************************************************/ 198 data WORK.NEWDATA ; 199 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 200 infile 'C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv' delimiter = ',' 200! MISSOVER DSD lrecl=32767 firstobs=2 ; 201 informat VAR1 $4. ; 202 informat time best32. ; 203 informat status best32. ; 204 informat DM1 best32. ; 205 informat DM2 best32. ; 206 format VAR1 $4. ; 207 format time best12. ; 208 format status best12. ; 209 format DM1 best12. ; 210 format DM2 best12. ; 211 input 212 VAR1 $ 213 time 214 status 215 DM1 216 DM2 217 ; 218 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 219 run; NOTE: The infile 'C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv' is: Filename=C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv, RECFM=V,LRECL=32767,File Size (bytes)=195596, Last Modified=08Jul2024:12:16:00, Create Time=08Jul2024:12:16:13 NOTE: 6347 records were read from the infile 'C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv'. The minimum record length was 13. The maximum record length was 31. NOTE: The data set WORK.NEWDATA has 6347 observations and 5 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds 6347 rows created in WORK.NEWDATA from C:\Users\Julian.Chen\Downloads\Voyager WIFI\07082024\newdata1.csv. NOTE: WORK.NEWDATA data set was successfully created. NOTE: The data set WORK.NEWDATA has 6347 observations and 5 variables. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.07 seconds cpu time 0.04 seconds 220 proc print data=newdata(obs=10); run; NOTE: Writing HTML Body file: sashtml.htm NOTE: There were 10 observations read from the data set WORK.NEWDATA. NOTE: PROCEDURE PRINT used (Total process time): real time 0.32 seconds cpu time 0.20 seconds 221 proc phreg data=newdata; 222 class DM1(ref="0"); 223 model time*status(0)=DM1; 224 output out=surv1 survival=s1; 225 run; NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK.SURV1 has 6347 observations and 6 variables. NOTE: PROCEDURE PHREG used (Total process time): real time 0.11 seconds cpu time 0.04 seconds 226 proc phreg data=newdata; 227 class DM1(ref="0") DM2(ref="0"); 228 model time*status(0)=DM1 DM2; 229 output out=surv2 survival=s2; 230 run; NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK.SURV2 has 6347 observations and 6 variables. NOTE: PROCEDURE PHREG used (Total process time): real time 0.10 seconds cpu time 0.04 seconds MPRINT(SURV_CONTNRI): * Macro to compute NRI with any up or down (no categories); MPRINT(SURV_CONTNRI): * Variables: * DSNAME = dataset name; MPRINT(SURV_CONTNRI): * DETAIL = 2 for detailed printout, 1 for limited, 0 for none; MPRINT(SURV_CONTNRI): * EVENT = outcome variable (coded 0,1); MPRINT(SURV_CONTNRI): * PYS = follow-up time; 231 MPRINT(SURV_CONTNRI): * T = time of predicted risk (eg., 10 years) = scalar; MPRINT(SURV_CONTNRI): * PROB1 = probability for model 1; MPRINT(SURV_CONTNRI): * PROB2 = probability for model 2; MPRINT(SURV_CONTNRI): *** NOTE: data need to be bootstrapped to get correct SE; 232 %SURV_CONTNRI(newdata,2,status,time,4,surv1,surv2); MPRINT(SURV_CONTNRI): title2 Continuous NRI for Event status at Time 4 : surv2 vs surv1 ; MPRINT(SURV_CONTNRI): title3 "Need to Bootstrap for SE"; MPRINT(SURV_CONTNRI): data nri1; MPRINT(SURV_CONTNRI): set newdata; MPRINT(SURV_CONTNRI): _id_=_N_; MPRINT(SURV_CONTNRI): * compute diffs in probs; MPRINT(SURV_CONTNRI): event=status; MPRINT(SURV_CONTNRI): pyrs=time; MPRINT(SURV_CONTNRI): prob1=surv1; MPRINT(SURV_CONTNRI): prob2=surv2; MPRINT(SURV_CONTNRI): diffp=prob2-prob1; MPRINT(SURV_CONTNRI): if prob1>. and prob2>.; MPRINT(SURV_CONTNRI): keep _id_ event pyrs prob1 prob2 diffp; MPRINT(SURV_CONTNRI): run; NOTE: Variable surv1 is uninitialized. NOTE: Variable surv2 is uninitialized. NOTE: Missing values were generated as a result of performing an operation on missing values. Each place is given by: (Number of times) at (Line):(Column). 6347 at 4:156 NOTE: There were 6347 observations read from the data set WORK.NEWDATA. NOTE: The data set WORK.NRI1 has 0 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds MPRINT(SURV_CONTNRI): data nri1; MPRINT(SURV_CONTNRI): set nri1; MPRINT(SURV_CONTNRI): if prob2>prob1 then disc=1; MPRINT(SURV_CONTNRI): else if prob2=prob1 then disc=0; MPRINT(SURV_CONTNRI): else if prob2