Hello all, I was hoping to find some help regarding this macro, which is from a paper named "A SAS macro for estimation of direct adjusted survival curves based on a stratified Cox regression model". However, when I try to apply the macro using the following code:
libname data "C:\Research 2\datacheck\datacheck1";
%INCLUDE 'ADJSURV.sas';
%_ADJSURV (data=data.cox
, time=time
, event=event
, group=group
, x=sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5 comorbidities6 concurrent1 concurrent2 concurrent previous after
, model=1
, out=data.coxout);
Here comes a lot of error.
I am having trouble identifying the cause, and I am sure this would be a simple resolution for someone with more experience utilizing macros. Any help would be very much appreciated. Thank you!
Here is the code from the paper:
/***************************************************************** _ADJSURV calculates the direct adjusted survival probabilities for K treatment groups at predetermined time points, based on a regular Cox model (Model=2) or a stratified Cox regression model (Model=1). Macro parameters: inputdata - the input sas data name; time - the survival time variable; event - the event indicator; group - the treatment group variable, which must take values 1,...,K for K<10 groups covlist - a list of covariate names; model - 1 if a stratified Cox model is selected, 2 if a regular Cox model is selected; outdata - the output sas data name. The output dataset contains: time - the event times survi, i=1,...,K sei, i=1,...,K seij, 1<=i<j<=K Authored by Xu Zhang 2007 Re-formatted by Rodney Sparapani 02/17/2014 *****************************************************************/ %*macro ADJSURV(inputdata, time, event, group, covlist, model, outdata); %macro _ADJSURV(data=REQUIRED, out=REQUIRED, time=REQUIRED, event=REQUIRED, group=REQUIRED, x=REQUIRED, model=1, inputdata=&data, outdata=&out, covlist=&x); %_require(&data &time &event &group &out &x) %local numgroup numcov i j adj1 adj2 group iter strata1 strata2; %let covlist=%_list(&covlist); %* 08/18/15; proc means data=&inputdata noprint; var &group; output out=maxout max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup', numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x; close &inputdata; numcov=ncol(x); create ncovout from numcov[colname='numcov']; append from numcov; close ncovout; run; quit; data _null_; set ncovout; call symput('numcov', numcov); run; %if &model=2 %then %do; /************************************/ /* */ /* Model 2 : A regular Cox model */ /* */ /************************************/ /*************************************************/ /* */ /* Assign names to variables in the input data. */ /* */ /*************************************************/ proc iml; use &inputdata; read all var {&time} into time; read all var {&event} into event; read all var {&group} into group; read all var {&covlist} into x; close &inputdata; numobs=nrow(time); gmat=j(&numgroup, &numgroup-1, 0); do i=2 to &numgroup; gmat[i, i-1]=1; end; zmat=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; zmat[i,]=gmat[group[i],]||x[i,]; end; out=time||event||zmat; names={'time' 'event' %do i=1 %to &numgroup-1+&numcov; "z&i" %end;}; create indata from out[colname=names]; append from out; close indata; quit; /**********************************************/ /* */ /* Get regression coefficient estimates from */ /* proc phreg, read in these estimates and */ /* calculate s0(b,t), s1(b,t). */ /* */ /**********************************************/ ODS LISTING CLOSE; proc freq data=indata; where event=1; table time/out=dcount; run; ODS LISTING; proc sort data=indata; by descending time event; run; proc phreg data=indata covout outest=best noprint; model time*event(0)= %do i=1 %to &numgroup-1+&numcov; z&i %end;; output out=coxout xbeta=zb; run; proc sort data=coxout; by descending time; run; data best sigma; set best; if _type_='PARMS' then output best; if _type_='COV' then output sigma; run; data riskset; set coxout; by descending time; keep time s0 s1:; s0+exp(zb); %do i=1 %to &numcov+&numgroup-1; s1_&i+z&i * exp(zb); %end; if event; run; data riskset; set riskset; by descending time; if last.time; run; proc sort data=riskset; by time; run; data riskset; merge riskset dcount (keep=time count); by time; run; /****************************************/ /* */ /* Get weighted survival function */ /* estimate and its variance estimate */ /* */ /****************************************/ proc iml; use riskset; read all var{time} into time; read all var{s0} into s0; read all var{%do i=1 %to &numgroup-1+&numcov; s1_&i %end;} into s1; read all var{count} into count; close riskset; use best; read all var{%do i=1 %to &numgroup-1+&numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numgroup-1+&numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=&numgroup %to &numgroup-1+&numcov; z&i %end;} into zmat; close indata; numtime=nrow(time); numobs=nrow(zmat); numcov=ncol(s1); ctemp=0; wtemp=0; cumuhaz=j(numtime,1,0); w1=j(numtime,1,0); do i=1 to numtime; ctemp=ctemp+count[i]/s0[i]; wtemp=wtemp+count[i]/s0[i]/s0[i]; cumuhaz[i]=ctemp; w1[i]=wtemp; end; /********************************************************/ /* */ /* Do loop calculate the direct adjusted probabilities */ /* and their variance estimates at time 'tau'. */ /* */ /********************************************************/ g=j(&numgroup, &numgroup-1,0); do i=2 to &numgroup; g[i,i-1]=1; end; survmat=time; %do iter=1 %to &numgroup; zz=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; zz[i,]=g[&iter,]||zmat[i,]; end; adjsurv=j(numtime,1,0); fexpbz=j(numtime,1,0); fh=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zz[i,]*t(b)); surv=exp(-cumuhaz)##expbz; adjsurv=adjsurv+surv; fexpbz=fexpbz+surv#expbz; h=j(numtime,numcov,0); htemp=j(1,numcov,0); do j=1 to numtime; htemp=htemp+count[j]/s0[j]*(zz[i,]-s1[j,]/s0[j]); h[j,]=htemp; end; fh=fh+surv#h#expbz; end; term1=(fexpbz##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh[i,]*sigma*t(fh[i,]); end; varsurv=term1+term2; adjsurv=adjsurv/numobs; varsurv=varsurv/numobs/numobs; sesurv=varsurv##0.5; survmat=survmat||adjsurv||sesurv; %end; /*********************************************************/ /* */ /* Calculate covariance estimates between two direct */ /* adjusted survival probabilities. */ /* */ /*********************************************************/ %do adj1=1 %to &numgroup; z1=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; z1[i,]=g[&adj1,]||zmat[i,]; end; %do adj2=&adj1+1 %to &numgroup; z2=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; z2[i,]=g[&adj2,]||zmat[i,]; end; fe2_fe1=j(numtime,1,0); fh2_fh1=j(numtime,numcov,0); do i=1 to numobs; h1=j(numtime,numcov,0); htemp1=j(1,numcov,0); do j=1 to numtime; htemp1=htemp1+count[j]/s0[j]*(z1[i,]-s1[j,]/s0[j]); h1[j,]=htemp1; end; h2=j(numtime,numcov,0); htemp2=j(1,numcov,0); do j=1 to numtime; htemp2=htemp2+count[j]/s0[j]*(z2[i,]-s1[j,]/s0[j]); h2[j,]=htemp2; end; expbz1=exp(z1[i,]*t(b)); expbz2=exp(z2[i,]*t(b)); surv1=exp(-cumuhaz)##expbz1; surv2=exp(-cumuhaz)##expbz2; fe2_fe1=fe2_fe1+surv2#expbz2-surv1#expbz1; fh2_fh1=fh2_fh1+surv2#h2#expbz2-surv1#h1#expbz1; end; term1=(fe2_fe1##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]); end; covar=term1+term2; covar=covar/numobs/numobs; sqcov=covar##0.5; survmat=survmat||sqcov; %end; %end; names={'time' %do i=1 %to &numgroup; "surv&i" "se&i" %end; %do i=1 %to &numgroup; %do j=&i+1 %to &numgroup; "se&i.&j" %end; %end; }; create mout from survmat[colname=names]; append from survmat; close mout; run; quit; %end; %else %do; /***************************************/ /* */ /* Model 1 : a stratified Cox model */ /* */ /***************************************/ proc iml; use &inputdata; read all var {&time} into time; read all var {&event} into event; read all var {&group} into group; read all var {&covlist} into x; close &inputdata; out=time||event||group||x; names={'time' 'event' 'strata' %do i=1 %to &numcov; "z&i" %end;}; create indata from out[colname=names]; append from out; close indata; run; quit; /**********************************************/ /* */ /* Get regression coefficient estimates from */ /* proc phreg, read in these estimates and */ /* calculate s0(b,t), s1(b,t). */ /* */ /**********************************************/ proc sort data=indata; by descending time descending event; run; data alltime; set indata (keep=time event); by descending time; drop event; if first.time; if event; run; proc sort data=alltime; by time; run; proc phreg data=indata covout outest=best noprint; model time*event(0)=%do i=1 %to &numcov; z&i %end;; strata strata; output out=coxout xbeta=zb; run; proc sort data=coxout; by strata descending time; run; data best sigma; set best; if _type_='PARMS' then output best; else if _type_='COV' then output sigma; run; %do group=1 %to &numgroup; data riskset&group; set coxout (keep=time strata %do i=1 %to &numcov; z&i %end; zb); where strata=&group; by descending time; keep time s0 %do i=1 %to &numcov; s1_&i %end;; s0+exp(zb); %do i=1 %to &numcov; s1_&i+z&i * exp(zb); %end; if last.time; run; proc sort data=riskset&group; by time; run; ODS LISTING CLOSE; proc freq data=indata; where strata=&group & event=1; table time/out=dcount&group; run; ODS LISTING; data riskset&group; merge alltime (in=inall) riskset&group dcount&group (keep=time count); by time; drop ts:; retain ts0 %do i=1 %to &numcov; ts1_&i %end; 999; if inall; if count=. then count=0; if s0^=. then ts0=s0; else s0=ts0; %do i=1 %to &numcov; if s1_&i^=. then ts1_&i=s1_&i; else s1_&i=ts1_&i; %end; run; /*****************************************************/ /* */ /* Calculate direct adjusted survival probabilites */ /* and their variance estimates at time 'tau'. */ /* */ /*****************************************************/ proc iml; use riskset&group; read all var{time} into time; read all var{s0} into s0; read all var{%do i=1 %to &numcov; s1_&i %end;} into s1; read all var{count} into count; close riskset&group; use best; read all var{%do i=1 %to &numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=1 %to &numcov; z&i %end;} into zmat; close indata; numtime=nrow(s0); numcov=ncol(s1); cumuhaz=j(numtime,1,0); w1=j(numtime,1,0); ctemp=0; wtemp=0; do i=1 to numtime; ctemp=ctemp+count[i]/s0[i]; wtemp=wtemp+count[i]/s0[i]/s0[i]; cumuhaz[i]=ctemp; w1[i]=wtemp; end; numobs=nrow(zmat); adjsurv=j(numtime,1,0); varsurv=j(numtime,1,0); fexpbz=j(numtime,1,0); fh=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zmat[i,]*t(b)); surv=exp(-cumuhaz)##expbz; adjsurv=adjsurv+surv; fexpbz=fexpbz+surv#expbz; h=j(numtime,numcov,0); htemp=j(1, numcov, 0); do j=1 to numtime; htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]); h[j,]=htemp; end; fh=fh+surv#h#expbz; end; adjsurv=adjsurv/numobs; term1=(fexpbz##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh[i,]*sigma*t(fh[i,]); end; varsurv=term1+term2; varsurv=varsurv/numobs/numobs; sesurv=varsurv##0.5; outmat=time||adjsurv||sesurv; names={'time' 'surv' 'se'}; create surv&group from outmat[colname=names]; append from outmat; close surv&group; run; quit; %end; /*******************************************************/ /* */ /* Calculate covariance estimates between two direct */ /* adjusted survival probabilities. */ /* */ /*******************************************************/ %do strata1=1 %to &numgroup; %do strata2=&strata1+1 %to &numgroup; proc iml; use riskset&strata1; read all var{time} into time; read all var{s0} into s01; read all var{%do i=1 %to &numcov; s1_&i %end;} into s11; read all var{count} into count1; close riskset&strata1; use riskset&strata2; read all var{s0} into s02; read all var{%do i=1 %to &numcov; s1_&i %end;} into s12; read all var{count} into count2; close riskset&strata2; use best; read all var{%do i=1 %to &numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=1 %to &numcov; z&i %end;} into zmat; close indata; numtime=nrow(time); numobs=nrow(zmat); numcov=ncol(s11); cumuhaz1=j(numtime,1,0); cumuhaz2=j(numtime,1,0); w1=j(numtime,1,0); w2=j(numtime,1,0); ctemp1=0; ctemp2=0; wtemp1=0; wtemp2=0; do i=1 to numtime; ctemp1=ctemp1+count1[i]/s01[i]; ctemp2=ctemp2+count2[i]/s02[i]; wtemp1=wtemp1+count1[i]/s01[i]/s01[i]; wtemp2=wtemp2+count2[i]/s02[i]/s02[i]; cumuhaz1[i]=ctemp1; cumuhaz2[i]=ctemp2; w1[i]=wtemp1; w2[i]=wtemp2; end; fexpbz1=j(numtime,1,0); fexpbz2=j(numtime,1,0); fh2_fh1=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zmat[i,]*t(b)); surv1=exp(-cumuhaz1)##expbz; surv2=exp(-cumuhaz2)##expbz; fexpbz1=fexpbz1+surv1#expbz; fexpbz2=fexpbz2+surv2#expbz; h1=j(numtime,numcov,0); h2=j(numtime,numcov,0); htemp1=j(1, numcov, 0); htemp2=j(1, numcov, 0); do j=1 to numtime; htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]); htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]); h1[j,]=htemp1; h2[j,]=htemp2; end; fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz; end; term1=(fexpbz1##2)#w1; term2=(fexpbz2##2)#w2; term3=j(numtime,1,0); do i=1 to numtime; term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]); end; covar=term1+term2+term3; covar=covar/numobs/numobs; cov=covar##0.5; names={'se'}; create cov&strata1&strata2 from cov[colname=names]; append from cov; close cov&strata1&strata2; run; quit; %end; %end; data mout; merge %do group=1 %to &numgroup; surv&group (rename=(surv=surv&group se=se&group)) %end; %do i=1 %to &numgroup; %do j=&i+1 %to &numgroup; cov&i&j (rename=(se=se&i.&j)) %end; %end;; run; %end; /**************************************/ /* */ /* Make final output data */ /* */ /**************************************/ data &outdata; time=0; %do i=1 %to &numgroup; surv&i=1; se&i=0; %do j=&i+1 %to &numgroup; se&i.&j=0; %end; %end; output; run; data &outdata; set &outdata mout; by time; run; %mend;
Here is the log
1 libname data "C:\Research 2\datacheck\datacheck1";
2 %INCLUDE 'ADJSURV.sas';
708 %_ADJSURV (data=data.cox
709 , time=time
710 , event=event
711 , group=group
712 , x=sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
712 ! comorbidities6 concurrent1 concurrent2 concurrent previous after
713 , model=1
714 , out=data.coxout);
1 %require(&data &time &event &group &out &x)
-
180
WARNING: Apparent invocation of macro REQUIRE not resolved.
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
3 proc means data=&inputdata noprint; var &group; output out=maxout
---
180
3 ! max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup',
3 ! numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x;
3 ! close
ERROR 180-322: Statement is not valid or it is used out of proper order.
3 proc means data=&inputdata noprint; var &group; output out=maxout
------
180
3 ! max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup',
3 ! numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x;
3 ! close
ERROR 180-322: Statement is not valid or it is used out of proper order.
ERROR: File WORK.MAXOUT.DATA does not exist.
1 %_list(sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
-
22
200
1 ! comorbidities6 concurrent1 concurrent2 concurrent previous after)
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
a numeric constant, a datetime constant, a missing value, (, (|, ), *, ',', -, =,
[, |, }.
ERROR 200-322: The symbol is not recognized and will be ignored.
WARNING: Some character data was lost during transcoding in the dataset DATA.COX. Either the data
contains characters that are not representable in the new encoding or truncation
occurred during transcoding.
1 %_list(sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
-
22
200
1 ! comorbidities6 concurrent1 concurrent2 concurrent previous after)
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
a numeric constant, a datetime constant, a missing value, (, (|, ), *, ',', -, =,
[, |, }.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The %TO value of the %DO GROUP loop is invalid.
ERROR: The macro _ADJSURV will stop executing.
Hello all, I was hoping to find some help regarding this macro, which is from a paper named "A SAS macro for estimation of direct adjusted survival curves based on a stratified Cox regression model". However, when I try to apply the macro using the following code:
libname data "C:\Research 2\datacheck\datacheck1";
%INCLUDE 'ADJSURV.sas';
%_ADJSURV (data=data.cox
, time=time
, event=event
, group=group
, x=sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5 comorbidities6 concurrent1 concurrent2 concurrent previous after
, model=1
, out=data.coxout);
I received a lot of error:
I am having trouble identifying the cause, and I am sure this would be a simple resolution for someone with more experience utilizing macros. Any help would be very much appreciated. Thank you!
Here is the code from the paper:
/***************************************************************** _ADJSURV calculates the direct adjusted survival probabilities for K treatment groups at predetermined time points, based on a regular Cox model (Model=2) or a stratified Cox regression model (Model=1). Macro parameters: inputdata - the input sas data name; time - the survival time variable; event - the event indicator; group - the treatment group variable, which must take values 1,...,K for K<10 groups covlist - a list of covariate names; model - 1 if a stratified Cox model is selected, 2 if a regular Cox model is selected; outdata - the output sas data name. The output dataset contains: time - the event times survi, i=1,...,K sei, i=1,...,K seij, 1<=i<j<=K Authored by Xu Zhang 2007 Re-formatted by Rodney Sparapani 02/17/2014 *****************************************************************/ %*macro ADJSURV(inputdata, time, event, group, covlist, model, outdata); %macro _ADJSURV(data=REQUIRED, out=REQUIRED, time=REQUIRED, event=REQUIRED, group=REQUIRED, x=REQUIRED, model=1, inputdata=&data, outdata=&out, covlist=&x); %_require(&data &time &event &group &out &x) %local numgroup numcov i j adj1 adj2 group iter strata1 strata2; %let covlist=%_list(&covlist); %* 08/18/15; proc means data=&inputdata noprint; var &group; output out=maxout max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup', numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x; close &inputdata; numcov=ncol(x); create ncovout from numcov[colname='numcov']; append from numcov; close ncovout; run; quit; data _null_; set ncovout; call symput('numcov', numcov); run; %if &model=2 %then %do; /************************************/ /* */ /* Model 2 : A regular Cox model */ /* */ /************************************/ /*************************************************/ /* */ /* Assign names to variables in the input data. */ /* */ /*************************************************/ proc iml; use &inputdata; read all var {&time} into time; read all var {&event} into event; read all var {&group} into group; read all var {&covlist} into x; close &inputdata; numobs=nrow(time); gmat=j(&numgroup, &numgroup-1, 0); do i=2 to &numgroup; gmat[i, i-1]=1; end; zmat=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; zmat[i,]=gmat[group[i],]||x[i,]; end; out=time||event||zmat; names={'time' 'event' %do i=1 %to &numgroup-1+&numcov; "z&i" %end;}; create indata from out[colname=names]; append from out; close indata; quit; /**********************************************/ /* */ /* Get regression coefficient estimates from */ /* proc phreg, read in these estimates and */ /* calculate s0(b,t), s1(b,t). */ /* */ /**********************************************/ ODS LISTING CLOSE; proc freq data=indata; where event=1; table time/out=dcount; run; ODS LISTING; proc sort data=indata; by descending time event; run; proc phreg data=indata covout outest=best noprint; model time*event(0)= %do i=1 %to &numgroup-1+&numcov; z&i %end;; output out=coxout xbeta=zb; run; proc sort data=coxout; by descending time; run; data best sigma; set best; if _type_='PARMS' then output best; if _type_='COV' then output sigma; run; data riskset; set coxout; by descending time; keep time s0 s1:; s0+exp(zb); %do i=1 %to &numcov+&numgroup-1; s1_&i+z&i * exp(zb); %end; if event; run; data riskset; set riskset; by descending time; if last.time; run; proc sort data=riskset; by time; run; data riskset; merge riskset dcount (keep=time count); by time; run; /****************************************/ /* */ /* Get weighted survival function */ /* estimate and its variance estimate */ /* */ /****************************************/ proc iml; use riskset; read all var{time} into time; read all var{s0} into s0; read all var{%do i=1 %to &numgroup-1+&numcov; s1_&i %end;} into s1; read all var{count} into count; close riskset; use best; read all var{%do i=1 %to &numgroup-1+&numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numgroup-1+&numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=&numgroup %to &numgroup-1+&numcov; z&i %end;} into zmat; close indata; numtime=nrow(time); numobs=nrow(zmat); numcov=ncol(s1); ctemp=0; wtemp=0; cumuhaz=j(numtime,1,0); w1=j(numtime,1,0); do i=1 to numtime; ctemp=ctemp+count[i]/s0[i]; wtemp=wtemp+count[i]/s0[i]/s0[i]; cumuhaz[i]=ctemp; w1[i]=wtemp; end; /********************************************************/ /* */ /* Do loop calculate the direct adjusted probabilities */ /* and their variance estimates at time 'tau'. */ /* */ /********************************************************/ g=j(&numgroup, &numgroup-1,0); do i=2 to &numgroup; g[i,i-1]=1; end; survmat=time; %do iter=1 %to &numgroup; zz=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; zz[i,]=g[&iter,]||zmat[i,]; end; adjsurv=j(numtime,1,0); fexpbz=j(numtime,1,0); fh=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zz[i,]*t(b)); surv=exp(-cumuhaz)##expbz; adjsurv=adjsurv+surv; fexpbz=fexpbz+surv#expbz; h=j(numtime,numcov,0); htemp=j(1,numcov,0); do j=1 to numtime; htemp=htemp+count[j]/s0[j]*(zz[i,]-s1[j,]/s0[j]); h[j,]=htemp; end; fh=fh+surv#h#expbz; end; term1=(fexpbz##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh[i,]*sigma*t(fh[i,]); end; varsurv=term1+term2; adjsurv=adjsurv/numobs; varsurv=varsurv/numobs/numobs; sesurv=varsurv##0.5; survmat=survmat||adjsurv||sesurv; %end; /*********************************************************/ /* */ /* Calculate covariance estimates between two direct */ /* adjusted survival probabilities. */ /* */ /*********************************************************/ %do adj1=1 %to &numgroup; z1=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; z1[i,]=g[&adj1,]||zmat[i,]; end; %do adj2=&adj1+1 %to &numgroup; z2=j(numobs, &numgroup-1+&numcov, 0); do i=1 to numobs; z2[i,]=g[&adj2,]||zmat[i,]; end; fe2_fe1=j(numtime,1,0); fh2_fh1=j(numtime,numcov,0); do i=1 to numobs; h1=j(numtime,numcov,0); htemp1=j(1,numcov,0); do j=1 to numtime; htemp1=htemp1+count[j]/s0[j]*(z1[i,]-s1[j,]/s0[j]); h1[j,]=htemp1; end; h2=j(numtime,numcov,0); htemp2=j(1,numcov,0); do j=1 to numtime; htemp2=htemp2+count[j]/s0[j]*(z2[i,]-s1[j,]/s0[j]); h2[j,]=htemp2; end; expbz1=exp(z1[i,]*t(b)); expbz2=exp(z2[i,]*t(b)); surv1=exp(-cumuhaz)##expbz1; surv2=exp(-cumuhaz)##expbz2; fe2_fe1=fe2_fe1+surv2#expbz2-surv1#expbz1; fh2_fh1=fh2_fh1+surv2#h2#expbz2-surv1#h1#expbz1; end; term1=(fe2_fe1##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]); end; covar=term1+term2; covar=covar/numobs/numobs; sqcov=covar##0.5; survmat=survmat||sqcov; %end; %end; names={'time' %do i=1 %to &numgroup; "surv&i" "se&i" %end; %do i=1 %to &numgroup; %do j=&i+1 %to &numgroup; "se&i.&j" %end; %end; }; create mout from survmat[colname=names]; append from survmat; close mout; run; quit; %end; %else %do; /***************************************/ /* */ /* Model 1 : a stratified Cox model */ /* */ /***************************************/ proc iml; use &inputdata; read all var {&time} into time; read all var {&event} into event; read all var {&group} into group; read all var {&covlist} into x; close &inputdata; out=time||event||group||x; names={'time' 'event' 'strata' %do i=1 %to &numcov; "z&i" %end;}; create indata from out[colname=names]; append from out; close indata; run; quit; /**********************************************/ /* */ /* Get regression coefficient estimates from */ /* proc phreg, read in these estimates and */ /* calculate s0(b,t), s1(b,t). */ /* */ /**********************************************/ proc sort data=indata; by descending time descending event; run; data alltime; set indata (keep=time event); by descending time; drop event; if first.time; if event; run; proc sort data=alltime; by time; run; proc phreg data=indata covout outest=best noprint; model time*event(0)=%do i=1 %to &numcov; z&i %end;; strata strata; output out=coxout xbeta=zb; run; proc sort data=coxout; by strata descending time; run; data best sigma; set best; if _type_='PARMS' then output best; else if _type_='COV' then output sigma; run; %do group=1 %to &numgroup; data riskset&group; set coxout (keep=time strata %do i=1 %to &numcov; z&i %end; zb); where strata=&group; by descending time; keep time s0 %do i=1 %to &numcov; s1_&i %end;; s0+exp(zb); %do i=1 %to &numcov; s1_&i+z&i * exp(zb); %end; if last.time; run; proc sort data=riskset&group; by time; run; ODS LISTING CLOSE; proc freq data=indata; where strata=&group & event=1; table time/out=dcount&group; run; ODS LISTING; data riskset&group; merge alltime (in=inall) riskset&group dcount&group (keep=time count); by time; drop ts:; retain ts0 %do i=1 %to &numcov; ts1_&i %end; 999; if inall; if count=. then count=0; if s0^=. then ts0=s0; else s0=ts0; %do i=1 %to &numcov; if s1_&i^=. then ts1_&i=s1_&i; else s1_&i=ts1_&i; %end; run; /*****************************************************/ /* */ /* Calculate direct adjusted survival probabilites */ /* and their variance estimates at time 'tau'. */ /* */ /*****************************************************/ proc iml; use riskset&group; read all var{time} into time; read all var{s0} into s0; read all var{%do i=1 %to &numcov; s1_&i %end;} into s1; read all var{count} into count; close riskset&group; use best; read all var{%do i=1 %to &numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=1 %to &numcov; z&i %end;} into zmat; close indata; numtime=nrow(s0); numcov=ncol(s1); cumuhaz=j(numtime,1,0); w1=j(numtime,1,0); ctemp=0; wtemp=0; do i=1 to numtime; ctemp=ctemp+count[i]/s0[i]; wtemp=wtemp+count[i]/s0[i]/s0[i]; cumuhaz[i]=ctemp; w1[i]=wtemp; end; numobs=nrow(zmat); adjsurv=j(numtime,1,0); varsurv=j(numtime,1,0); fexpbz=j(numtime,1,0); fh=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zmat[i,]*t(b)); surv=exp(-cumuhaz)##expbz; adjsurv=adjsurv+surv; fexpbz=fexpbz+surv#expbz; h=j(numtime,numcov,0); htemp=j(1, numcov, 0); do j=1 to numtime; htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]); h[j,]=htemp; end; fh=fh+surv#h#expbz; end; adjsurv=adjsurv/numobs; term1=(fexpbz##2)#w1; term2=j(numtime,1,0); do i=1 to numtime; term2[i]=fh[i,]*sigma*t(fh[i,]); end; varsurv=term1+term2; varsurv=varsurv/numobs/numobs; sesurv=varsurv##0.5; outmat=time||adjsurv||sesurv; names={'time' 'surv' 'se'}; create surv&group from outmat[colname=names]; append from outmat; close surv&group; run; quit; %end; /*******************************************************/ /* */ /* Calculate covariance estimates between two direct */ /* adjusted survival probabilities. */ /* */ /*******************************************************/ %do strata1=1 %to &numgroup; %do strata2=&strata1+1 %to &numgroup; proc iml; use riskset&strata1; read all var{time} into time; read all var{s0} into s01; read all var{%do i=1 %to &numcov; s1_&i %end;} into s11; read all var{count} into count1; close riskset&strata1; use riskset&strata2; read all var{s0} into s02; read all var{%do i=1 %to &numcov; s1_&i %end;} into s12; read all var{count} into count2; close riskset&strata2; use best; read all var{%do i=1 %to &numcov; z&i %end;} into b; close best; use sigma; read all var{%do i=1 %to &numcov; z&i %end;} into sigma; close sigma; use indata; read all var{%do i=1 %to &numcov; z&i %end;} into zmat; close indata; numtime=nrow(time); numobs=nrow(zmat); numcov=ncol(s11); cumuhaz1=j(numtime,1,0); cumuhaz2=j(numtime,1,0); w1=j(numtime,1,0); w2=j(numtime,1,0); ctemp1=0; ctemp2=0; wtemp1=0; wtemp2=0; do i=1 to numtime; ctemp1=ctemp1+count1[i]/s01[i]; ctemp2=ctemp2+count2[i]/s02[i]; wtemp1=wtemp1+count1[i]/s01[i]/s01[i]; wtemp2=wtemp2+count2[i]/s02[i]/s02[i]; cumuhaz1[i]=ctemp1; cumuhaz2[i]=ctemp2; w1[i]=wtemp1; w2[i]=wtemp2; end; fexpbz1=j(numtime,1,0); fexpbz2=j(numtime,1,0); fh2_fh1=j(numtime,numcov,0); do i=1 to numobs; expbz=exp(zmat[i,]*t(b)); surv1=exp(-cumuhaz1)##expbz; surv2=exp(-cumuhaz2)##expbz; fexpbz1=fexpbz1+surv1#expbz; fexpbz2=fexpbz2+surv2#expbz; h1=j(numtime,numcov,0); h2=j(numtime,numcov,0); htemp1=j(1, numcov, 0); htemp2=j(1, numcov, 0); do j=1 to numtime; htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]); htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]); h1[j,]=htemp1; h2[j,]=htemp2; end; fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz; end; term1=(fexpbz1##2)#w1; term2=(fexpbz2##2)#w2; term3=j(numtime,1,0); do i=1 to numtime; term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]); end; covar=term1+term2+term3; covar=covar/numobs/numobs; cov=covar##0.5; names={'se'}; create cov&strata1&strata2 from cov[colname=names]; append from cov; close cov&strata1&strata2; run; quit; %end; %end; data mout; merge %do group=1 %to &numgroup; surv&group (rename=(surv=surv&group se=se&group)) %end; %do i=1 %to &numgroup; %do j=&i+1 %to &numgroup; cov&i&j (rename=(se=se&i.&j)) %end; %end;; run; %end; /**************************************/ /* */ /* Make final output data */ /* */ /**************************************/ data &outdata; time=0; %do i=1 %to &numgroup; surv&i=1; se&i=0; %do j=&i+1 %to &numgroup; se&i.&j=0; %end; %end; output; run; data &outdata; set &outdata mout; by time; run; %mend;
and here is the log of SAS:
1 libname data "C:\Research 2\datacheck\datacheck1";
NOTE: Libref DATA was successfully assigned as follows:
Engine: V9
Physical Name: C:\Research 2\datacheck\datacheck1
2 %INCLUDE 'ADJSURV.sas';
708 %_ADJSURV (data=data.cox
709 , time=time
710 , event=event
711 , group=group
712 , x=sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
712 ! comorbidities6 concurrent1 concurrent2 concurrent previous after
713 , model=1
714 , out=data.coxout);
NOTE: Line generated by the invoked macro "_ADJSURV".
1 %require(&data &time &event &group &out &x)
-
180
WARNING: Apparent invocation of macro REQUIRE not resolved.
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
NOTE: Line generated by the invoked macro "_ADJSURV".
3 proc means data=&inputdata noprint; var &group; output out=maxout
---
180
3 ! max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup',
3 ! numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x;
3 ! close
ERROR 180-322: Statement is not valid or it is used out of proper order.
NOTE: Line generated by the invoked macro "_ADJSURV".
3 proc means data=&inputdata noprint; var &group; output out=maxout
------
180
3 ! max(&group)=numgroup; run; data _null_; set maxout; call symput('numgroup',
3 ! numgroup); run; proc iml; use &inputdata; read all var {&covlist} into x;
3 ! close
ERROR 180-322: Statement is not valid or it is used out of proper order.
ERROR: File WORK.MAXOUT.DATA does not exist.
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
1079:162
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: Writing HTML Body file: sashtml.htm
NOTE: IML Ready
NOTE: Data file DATA.COX.DATA is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
NOTE: Line generated by the macro variable "COVLIST".
1 %_list(sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
-
22
200
1 ! comorbidities6 concurrent1 concurrent2 concurrent previous after)
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
a numeric constant, a datetime constant, a missing value, (, (|, ), *, ',', -, =,
[, |, }.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: The data set WORK.NCOVOUT has 1 observations and 1 variables.
NOTE: Module MAIN is undefined in IML; cannot be RUN.
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.53 seconds
cpu time 0.35 seconds
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
4:197
NOTE: There were 1 observations read from the data set WORK.NCOVOUT.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: IML Ready
NOTE: Data file DATA.COX.DATA is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
WARNING: Some character data was lost during transcoding in the dataset DATA.COX. Either the data
contains characters that are not representable in the new encoding or truncation
occurred during transcoding.
NOTE: Line generated by the macro variable "COVLIST".
1 %_list(sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
-
22
200
1 ! comorbidities6 concurrent1 concurrent2 concurrent previous after)
WARNING: Apparent invocation of macro _LIST not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
a numeric constant, a datetime constant, a missing value, (, (|, ), *, ',', -, =,
[, |, }.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: The data set WORK.INDATA has 979 observations and 3 variables.
NOTE: Module MAIN is undefined in IML; cannot be RUN.
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.07 seconds
cpu time 0.06 seconds
NOTE: There were 979 observations read from the data set WORK.INDATA.
NOTE: The data set WORK.INDATA has 979 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
NOTE: There were 979 observations read from the data set WORK.INDATA.
NOTE: The data set WORK.ALLTIME has 166 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: The data set WORK.ALLTIME has 166 observations and 1 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: There are no explanatory variables in the MODEL statement.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: The data set WORK.BEST has 1 observations and 5 variables.
NOTE: The data set WORK.COXOUT has 979 observations and 4 variables.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.10 seconds
cpu time 0.03 seconds
NOTE: There were 979 observations read from the data set WORK.COXOUT.
NOTE: The data set WORK.COXOUT has 979 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: There were 1 observations read from the data set WORK.BEST.
NOTE: The data set WORK.BEST has 1 observations and 5 variables.
NOTE: The data set WORK.SIGMA has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.
ERROR: The %TO value of the %DO GROUP loop is invalid.
ERROR: The macro _ADJSURV will stop executing.
1.Your log has warnings and error messages. Please pay attention to them.
2.Run the code in parts, step by step and then convert it to macro.
First of all, please read the error message carefully. It's the basics.
WARNING: Apparent invocation of macro REQUIRE not resolved.
WARNING: Apparent invocation of macro _LIST not resolved.
I don't have access to the paper, so I can't say for sure, but it seems that %require and %_list are not referenced in the code used internally.
We need to fix this first.
Is there any other code example in the paper?
Thank you Kawakami. There are no other code example in the paper. Though the log is long, there are mainly two errors. The one is ERROR 180-322, and the other is ERROR 22-322 and ERROR 200-322. Are these errors fixable?
Thank you again!
That error is most likely caused by %_require, so first
The error is most likely caused by %_require, so I think you need to solve the problem of %_require and %_list first.
I think one way to do this is to ask the author of the paper.
For now, try commenting out the %_require and %_list lines.
I don't know if it will work correctly, but I think it will fix the error you are seeing.
Thank you Kawakami. I have tried commenting out the 2 lines as you suggested. The warnings and errors did disappear and come a result. However, the result is not as the paper showed. The log is like this:
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M4)
Licensed to KYOTO UNIVERSITY -SCSK, Site 10209371.
NOTE: This session is executing on the X64_10HOME platform.
NOTE: Updated analytical products:
SAS/STAT 14.2
SAS/ETS 14.2
SAS/OR 14.2
SAS/IML 14.2
SAS/QC 14.2
NOTE: Additional host information:
X64_10HOME WIN 10.0.19041 Workstation
NOTE: SAS initialization used:
real time 1.42 seconds
cpu time 1.04 seconds
1 libname data "C:\Research 2\datacheck\datacheck1";
NOTE: Libref DATA was successfully assigned as follows:
Engine: V9
Physical Name: C:\Research 2\datacheck\datacheck1
2 options mprint;
3 %INCLUDE 'ADJSURV.sas';
711 %_ADJSURV (data=data.cox
712 , time=time
713 , event=event
714 , group=group
715 , x=sex1 age1 comorbidities1 comorbidities2 comorbidities3 comorbidities4 comorbidities5
715 ! comorbidities6 concurrent1 concurrent2 concurrent previous after
716 , model=1
717 , out=data.coxout);
NOTE: Data file DATA.COX.DATA is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
MPRINT(_ADJSURV): proc means data=data.cox noprint;
MPRINT(_ADJSURV): var group;
MPRINT(_ADJSURV): output out=maxout max(group)=numgroup;
MPRINT(_ADJSURV): run;
NOTE: There were 979 observations read from the data set DATA.COX.
NOTE: The data set WORK.MAXOUT has 1 observations and 3 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): data _null_;
MPRINT(_ADJSURV): set maxout;
MPRINT(_ADJSURV): call symput('numgroup', numgroup);
MPRINT(_ADJSURV): run;
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
1072:162
NOTE: There were 1 observations read from the data set WORK.MAXOUT.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: IML Ready
MPRINT(_ADJSURV): use data.cox;
NOTE: Data file DATA.COX.DATA is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
MPRINT(_ADJSURV): read all var {sex1 age1 comorbidities1 comorbidities2 comorbidities3
comorbidities4 comorbidities5 comorbidities6 concurrent1 concurrent2 concurrent previous after}
into x;
WARNING: Some character data was lost during transcoding in the dataset DATA.COX. Either the data
contains characters that are not representable in the new encoding or truncation
occurred during transcoding.
MPRINT(_ADJSURV): close data.cox;
MPRINT(_ADJSURV): numcov=ncol(x);
MPRINT(_ADJSURV): create ncovout from numcov[colname='numcov'];
MPRINT(_ADJSURV): append from numcov;
MPRINT(_ADJSURV): close ncovout;
NOTE: The data set WORK.NCOVOUT has 1 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.55 seconds
cpu time 0.39 seconds
MPRINT(_ADJSURV): data _null_;
MPRINT(_ADJSURV): set ncovout;
MPRINT(_ADJSURV): call symput('numcov', numcov);
MPRINT(_ADJSURV): run;
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
2:197
NOTE: There were 1 observations read from the data set WORK.NCOVOUT.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use data.cox;
NOTE: Data file DATA.COX.DATA is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
MPRINT(_ADJSURV): read all var {time} into time;
WARNING: Some character data was lost during transcoding in the dataset DATA.COX. Either the data
contains characters that are not representable in the new encoding or truncation
occurred during transcoding.
MPRINT(_ADJSURV): read all var {event} into event;
MPRINT(_ADJSURV): read all var {group} into group;
MPRINT(_ADJSURV): read all var {sex1 age1 comorbidities1 comorbidities2 comorbidities3
comorbidities4 comorbidities5 comorbidities6 concurrent1 concurrent2 concurrent previous after}
into x;
MPRINT(_ADJSURV): close data.cox;
MPRINT(_ADJSURV): out=time||event||group||x;
MPRINT(_ADJSURV): names={'time' 'event' 'strata' "z1" "z2" "z3" "z4" "z5" "z6" "z7" "z8" "z9"
"z10" "z11" "z12" "z13"};
MPRINT(_ADJSURV): create indata from out[colname=names];
MPRINT(_ADJSURV): append from out;
MPRINT(_ADJSURV): close indata;
NOTE: The data set WORK.INDATA has 979 observations and 16 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.07 seconds
cpu time 0.07 seconds
MPRINT(_ADJSURV): proc sort data=indata;
MPRINT(_ADJSURV): by descending time descending event;
MPRINT(_ADJSURV): run;
NOTE: There were 979 observations read from the data set WORK.INDATA.
NOTE: The data set WORK.INDATA has 979 observations and 16 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): data alltime;
MPRINT(_ADJSURV): set indata (keep=time event);
MPRINT(_ADJSURV): by descending time;
MPRINT(_ADJSURV): drop event;
MPRINT(_ADJSURV): if first.time;
MPRINT(_ADJSURV): if event;
MPRINT(_ADJSURV): run;
NOTE: There were 979 observations read from the data set WORK.INDATA.
NOTE: The data set WORK.ALLTIME has 166 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): proc sort data=alltime;
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: The data set WORK.ALLTIME has 166 observations and 1 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): proc phreg data=indata covout outest=best noprint;
MPRINT(_ADJSURV): model time*event(0)= z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13;
MPRINT(_ADJSURV): strata strata;
MPRINT(_ADJSURV): output out=coxout xbeta=zb;
MPRINT(_ADJSURV): run;
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: The data set WORK.BEST has 14 observations and 18 variables.
NOTE: The data set WORK.COXOUT has 979 observations and 17 variables.
NOTE: PROCEDURE PHREG used (Total process time):
real time 0.12 seconds
cpu time 0.07 seconds
MPRINT(_ADJSURV): proc sort data=coxout;
MPRINT(_ADJSURV): by strata descending time;
MPRINT(_ADJSURV): run;
NOTE: There were 979 observations read from the data set WORK.COXOUT.
NOTE: The data set WORK.COXOUT has 979 observations and 17 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): data best sigma;
MPRINT(_ADJSURV): set best;
MPRINT(_ADJSURV): if _type_='PARMS' then output best;
MPRINT(_ADJSURV): else if _type_='COV' then output sigma;
MPRINT(_ADJSURV): run;
NOTE: There were 14 observations read from the data set WORK.BEST.
NOTE: The data set WORK.BEST has 1 observations and 18 variables.
NOTE: The data set WORK.SIGMA has 13 observations and 18 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): data riskset1;
MPRINT(_ADJSURV): set coxout (keep=time strata z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 zb);
MPRINT(_ADJSURV): where strata=1;
MPRINT(_ADJSURV): by descending time;
MPRINT(_ADJSURV): keep time s0 s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13;
MPRINT(_ADJSURV): s0+exp(zb);
MPRINT(_ADJSURV): s1_1+z1 * exp(zb);
MPRINT(_ADJSURV): s1_2+z2 * exp(zb);
MPRINT(_ADJSURV): s1_3+z3 * exp(zb);
MPRINT(_ADJSURV): s1_4+z4 * exp(zb);
MPRINT(_ADJSURV): s1_5+z5 * exp(zb);
MPRINT(_ADJSURV): s1_6+z6 * exp(zb);
MPRINT(_ADJSURV): s1_7+z7 * exp(zb);
MPRINT(_ADJSURV): s1_8+z8 * exp(zb);
MPRINT(_ADJSURV): s1_9+z9 * exp(zb);
MPRINT(_ADJSURV): s1_10+z10 * exp(zb);
MPRINT(_ADJSURV): s1_11+z11 * exp(zb);
MPRINT(_ADJSURV): s1_12+z12 * exp(zb);
MPRINT(_ADJSURV): s1_13+z13 * exp(zb);
MPRINT(_ADJSURV): if last.time;
MPRINT(_ADJSURV): run;
NOTE: There were 98 observations read from the data set WORK.COXOUT.
WHERE strata=1;
NOTE: The data set WORK.RISKSET1 has 35 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc sort data=riskset1;
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: There were 35 observations read from the data set WORK.RISKSET1.
NOTE: The data set WORK.RISKSET1 has 35 observations and 15 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): ODS LISTING CLOSE;
MPRINT(_ADJSURV): proc freq data=indata;
MPRINT(_ADJSURV): where strata=1 & event=1;
MPRINT(_ADJSURV): table time/out=dcount1;
MPRINT(_ADJSURV): run;
NOTE: There were 41 observations read from the data set WORK.INDATA.
WHERE (strata=1) and (event=1);
NOTE: The data set WORK.DCOUNT1 has 34 observations and 3 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
MPRINT(_ADJSURV): ODS LISTING;
MPRINT(_ADJSURV): data riskset1;
MPRINT(_ADJSURV): merge alltime (in=inall) riskset1 dcount1 (keep=time count);
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): drop ts:;
MPRINT(_ADJSURV): retain ts0 ts1_1 ts1_2 ts1_3 ts1_4 ts1_5 ts1_6 ts1_7 ts1_8 ts1_9 ts1_10
ts1_11 ts1_12 ts1_13 999;
MPRINT(_ADJSURV): if inall;
MPRINT(_ADJSURV): if count=. then count=0;
MPRINT(_ADJSURV): if s0^=. then ts0=s0;
MPRINT(_ADJSURV): else s0=ts0;
MPRINT(_ADJSURV): if s1_1^=. then ts1_1=s1_1;
MPRINT(_ADJSURV): else s1_1=ts1_1;
MPRINT(_ADJSURV): if s1_2^=. then ts1_2=s1_2;
MPRINT(_ADJSURV): else s1_2=ts1_2;
MPRINT(_ADJSURV): if s1_3^=. then ts1_3=s1_3;
MPRINT(_ADJSURV): else s1_3=ts1_3;
MPRINT(_ADJSURV): if s1_4^=. then ts1_4=s1_4;
MPRINT(_ADJSURV): else s1_4=ts1_4;
MPRINT(_ADJSURV): if s1_5^=. then ts1_5=s1_5;
MPRINT(_ADJSURV): else s1_5=ts1_5;
MPRINT(_ADJSURV): if s1_6^=. then ts1_6=s1_6;
MPRINT(_ADJSURV): else s1_6=ts1_6;
MPRINT(_ADJSURV): if s1_7^=. then ts1_7=s1_7;
MPRINT(_ADJSURV): else s1_7=ts1_7;
MPRINT(_ADJSURV): if s1_8^=. then ts1_8=s1_8;
MPRINT(_ADJSURV): else s1_8=ts1_8;
MPRINT(_ADJSURV): if s1_9^=. then ts1_9=s1_9;
MPRINT(_ADJSURV): else s1_9=ts1_9;
MPRINT(_ADJSURV): if s1_10^=. then ts1_10=s1_10;
MPRINT(_ADJSURV): else s1_10=ts1_10;
MPRINT(_ADJSURV): if s1_11^=. then ts1_11=s1_11;
MPRINT(_ADJSURV): else s1_11=ts1_11;
MPRINT(_ADJSURV): if s1_12^=. then ts1_12=s1_12;
MPRINT(_ADJSURV): else s1_12=ts1_12;
MPRINT(_ADJSURV): if s1_13^=. then ts1_13=s1_13;
MPRINT(_ADJSURV): else s1_13=ts1_13;
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: There were 35 observations read from the data set WORK.RISKSET1.
NOTE: There were 34 observations read from the data set WORK.DCOUNT1.
NOTE: The data set WORK.RISKSET1 has 166 observations and 16 variables.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset1;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s0;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s1;
MPRINT(_ADJSURV): read all var{count} into count;
MPRINT(_ADJSURV): close riskset1;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(s0);
MPRINT(_ADJSURV): numcov=ncol(s1);
MPRINT(_ADJSURV): cumuhaz=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp=0;
MPRINT(_ADJSURV): wtemp=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp=ctemp+count[i]/s0[i];
MPRINT(_ADJSURV): wtemp=wtemp+count[i]/s0[i]/s0[i];
MPRINT(_ADJSURV): cumuhaz[i]=ctemp;
MPRINT(_ADJSURV): w1[i]=wtemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): adjsurv=j(numtime,1,0);
MPRINT(_ADJSURV): varsurv=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz=j(numtime,1,0);
MPRINT(_ADJSURV): fh=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv=exp(-cumuhaz)##expbz;
MPRINT(_ADJSURV): adjsurv=adjsurv+surv;
MPRINT(_ADJSURV): fexpbz=fexpbz+surv#expbz;
MPRINT(_ADJSURV): h=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]);
MPRINT(_ADJSURV): h[j,]=htemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh=fh+surv#h#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): adjsurv=adjsurv/numobs;
MPRINT(_ADJSURV): term1=(fexpbz##2)#w1;
MPRINT(_ADJSURV): term2=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term2[i]=fh[i,]*sigma*t(fh[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): varsurv=term1+term2;
MPRINT(_ADJSURV): varsurv=varsurv/numobs/numobs;
MPRINT(_ADJSURV): sesurv=varsurv##0.5;
MPRINT(_ADJSURV): outmat=time||adjsurv||sesurv;
MPRINT(_ADJSURV): names={'time' 'surv' 'se'};
MPRINT(_ADJSURV): create surv1 from outmat[colname=names];
MPRINT(_ADJSURV): append from outmat;
MPRINT(_ADJSURV): close surv1;
NOTE: The data set WORK.SURV1 has 166 observations and 3 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.65 seconds
cpu time 0.62 seconds
MPRINT(_ADJSURV): data riskset2;
MPRINT(_ADJSURV): set coxout (keep=time strata z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 zb);
MPRINT(_ADJSURV): where strata=2;
MPRINT(_ADJSURV): by descending time;
MPRINT(_ADJSURV): keep time s0 s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13;
MPRINT(_ADJSURV): s0+exp(zb);
MPRINT(_ADJSURV): s1_1+z1 * exp(zb);
MPRINT(_ADJSURV): s1_2+z2 * exp(zb);
MPRINT(_ADJSURV): s1_3+z3 * exp(zb);
MPRINT(_ADJSURV): s1_4+z4 * exp(zb);
MPRINT(_ADJSURV): s1_5+z5 * exp(zb);
MPRINT(_ADJSURV): s1_6+z6 * exp(zb);
MPRINT(_ADJSURV): s1_7+z7 * exp(zb);
MPRINT(_ADJSURV): s1_8+z8 * exp(zb);
MPRINT(_ADJSURV): s1_9+z9 * exp(zb);
MPRINT(_ADJSURV): s1_10+z10 * exp(zb);
MPRINT(_ADJSURV): s1_11+z11 * exp(zb);
MPRINT(_ADJSURV): s1_12+z12 * exp(zb);
MPRINT(_ADJSURV): s1_13+z13 * exp(zb);
MPRINT(_ADJSURV): if last.time;
MPRINT(_ADJSURV): run;
NOTE: There were 148 observations read from the data set WORK.COXOUT.
WHERE strata=2;
NOTE: The data set WORK.RISKSET2 has 29 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc sort data=riskset2;
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: There were 29 observations read from the data set WORK.RISKSET2.
NOTE: The data set WORK.RISKSET2 has 29 observations and 15 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
MPRINT(_ADJSURV): ODS LISTING CLOSE;
MPRINT(_ADJSURV): proc freq data=indata;
MPRINT(_ADJSURV): where strata=2 & event=1;
MPRINT(_ADJSURV): table time/out=dcount2;
MPRINT(_ADJSURV): run;
NOTE: There were 37 observations read from the data set WORK.INDATA.
WHERE (strata=2) and (event=1);
NOTE: The data set WORK.DCOUNT2 has 28 observations and 3 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.05 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): ODS LISTING;
MPRINT(_ADJSURV): data riskset2;
MPRINT(_ADJSURV): merge alltime (in=inall) riskset2 dcount2 (keep=time count);
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): drop ts:;
MPRINT(_ADJSURV): retain ts0 ts1_1 ts1_2 ts1_3 ts1_4 ts1_5 ts1_6 ts1_7 ts1_8 ts1_9 ts1_10
ts1_11 ts1_12 ts1_13 999;
MPRINT(_ADJSURV): if inall;
MPRINT(_ADJSURV): if count=. then count=0;
MPRINT(_ADJSURV): if s0^=. then ts0=s0;
MPRINT(_ADJSURV): else s0=ts0;
MPRINT(_ADJSURV): if s1_1^=. then ts1_1=s1_1;
MPRINT(_ADJSURV): else s1_1=ts1_1;
MPRINT(_ADJSURV): if s1_2^=. then ts1_2=s1_2;
MPRINT(_ADJSURV): else s1_2=ts1_2;
MPRINT(_ADJSURV): if s1_3^=. then ts1_3=s1_3;
MPRINT(_ADJSURV): else s1_3=ts1_3;
MPRINT(_ADJSURV): if s1_4^=. then ts1_4=s1_4;
MPRINT(_ADJSURV): else s1_4=ts1_4;
MPRINT(_ADJSURV): if s1_5^=. then ts1_5=s1_5;
MPRINT(_ADJSURV): else s1_5=ts1_5;
MPRINT(_ADJSURV): if s1_6^=. then ts1_6=s1_6;
MPRINT(_ADJSURV): else s1_6=ts1_6;
MPRINT(_ADJSURV): if s1_7^=. then ts1_7=s1_7;
MPRINT(_ADJSURV): else s1_7=ts1_7;
MPRINT(_ADJSURV): if s1_8^=. then ts1_8=s1_8;
MPRINT(_ADJSURV): else s1_8=ts1_8;
MPRINT(_ADJSURV): if s1_9^=. then ts1_9=s1_9;
MPRINT(_ADJSURV): else s1_9=ts1_9;
MPRINT(_ADJSURV): if s1_10^=. then ts1_10=s1_10;
MPRINT(_ADJSURV): else s1_10=ts1_10;
MPRINT(_ADJSURV): if s1_11^=. then ts1_11=s1_11;
MPRINT(_ADJSURV): else s1_11=ts1_11;
MPRINT(_ADJSURV): if s1_12^=. then ts1_12=s1_12;
MPRINT(_ADJSURV): else s1_12=ts1_12;
MPRINT(_ADJSURV): if s1_13^=. then ts1_13=s1_13;
MPRINT(_ADJSURV): else s1_13=ts1_13;
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: There were 29 observations read from the data set WORK.RISKSET2.
NOTE: There were 28 observations read from the data set WORK.DCOUNT2.
NOTE: The data set WORK.RISKSET2 has 166 observations and 16 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset2;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s0;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s1;
MPRINT(_ADJSURV): read all var{count} into count;
MPRINT(_ADJSURV): close riskset2;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(s0);
MPRINT(_ADJSURV): numcov=ncol(s1);
MPRINT(_ADJSURV): cumuhaz=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp=0;
MPRINT(_ADJSURV): wtemp=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp=ctemp+count[i]/s0[i];
MPRINT(_ADJSURV): wtemp=wtemp+count[i]/s0[i]/s0[i];
MPRINT(_ADJSURV): cumuhaz[i]=ctemp;
MPRINT(_ADJSURV): w1[i]=wtemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): adjsurv=j(numtime,1,0);
MPRINT(_ADJSURV): varsurv=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz=j(numtime,1,0);
MPRINT(_ADJSURV): fh=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv=exp(-cumuhaz)##expbz;
MPRINT(_ADJSURV): adjsurv=adjsurv+surv;
MPRINT(_ADJSURV): fexpbz=fexpbz+surv#expbz;
MPRINT(_ADJSURV): h=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]);
MPRINT(_ADJSURV): h[j,]=htemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh=fh+surv#h#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): adjsurv=adjsurv/numobs;
MPRINT(_ADJSURV): term1=(fexpbz##2)#w1;
MPRINT(_ADJSURV): term2=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term2[i]=fh[i,]*sigma*t(fh[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): varsurv=term1+term2;
MPRINT(_ADJSURV): varsurv=varsurv/numobs/numobs;
MPRINT(_ADJSURV): sesurv=varsurv##0.5;
MPRINT(_ADJSURV): outmat=time||adjsurv||sesurv;
MPRINT(_ADJSURV): names={'time' 'surv' 'se'};
MPRINT(_ADJSURV): create surv2 from outmat[colname=names];
MPRINT(_ADJSURV): append from outmat;
MPRINT(_ADJSURV): close surv2;
NOTE: The data set WORK.SURV2 has 166 observations and 3 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.59 seconds
cpu time 0.54 seconds
MPRINT(_ADJSURV): data riskset3;
MPRINT(_ADJSURV): set coxout (keep=time strata z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 zb);
MPRINT(_ADJSURV): where strata=3;
MPRINT(_ADJSURV): by descending time;
MPRINT(_ADJSURV): keep time s0 s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13;
MPRINT(_ADJSURV): s0+exp(zb);
MPRINT(_ADJSURV): s1_1+z1 * exp(zb);
MPRINT(_ADJSURV): s1_2+z2 * exp(zb);
MPRINT(_ADJSURV): s1_3+z3 * exp(zb);
MPRINT(_ADJSURV): s1_4+z4 * exp(zb);
MPRINT(_ADJSURV): s1_5+z5 * exp(zb);
MPRINT(_ADJSURV): s1_6+z6 * exp(zb);
MPRINT(_ADJSURV): s1_7+z7 * exp(zb);
MPRINT(_ADJSURV): s1_8+z8 * exp(zb);
MPRINT(_ADJSURV): s1_9+z9 * exp(zb);
MPRINT(_ADJSURV): s1_10+z10 * exp(zb);
MPRINT(_ADJSURV): s1_11+z11 * exp(zb);
MPRINT(_ADJSURV): s1_12+z12 * exp(zb);
MPRINT(_ADJSURV): s1_13+z13 * exp(zb);
MPRINT(_ADJSURV): if last.time;
MPRINT(_ADJSURV): run;
NOTE: There were 86 observations read from the data set WORK.COXOUT.
WHERE strata=3;
NOTE: The data set WORK.RISKSET3 has 34 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc sort data=riskset3;
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: There were 34 observations read from the data set WORK.RISKSET3.
NOTE: The data set WORK.RISKSET3 has 34 observations and 15 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
MPRINT(_ADJSURV): ODS LISTING CLOSE;
MPRINT(_ADJSURV): proc freq data=indata;
MPRINT(_ADJSURV): where strata=3 & event=1;
MPRINT(_ADJSURV): table time/out=dcount3;
MPRINT(_ADJSURV): run;
NOTE: There were 38 observations read from the data set WORK.INDATA.
WHERE (strata=3) and (event=1);
NOTE: The data set WORK.DCOUNT3 has 33 observations and 3 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
MPRINT(_ADJSURV): ODS LISTING;
MPRINT(_ADJSURV): data riskset3;
MPRINT(_ADJSURV): merge alltime (in=inall) riskset3 dcount3 (keep=time count);
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): drop ts:;
MPRINT(_ADJSURV): retain ts0 ts1_1 ts1_2 ts1_3 ts1_4 ts1_5 ts1_6 ts1_7 ts1_8 ts1_9 ts1_10
ts1_11 ts1_12 ts1_13 999;
MPRINT(_ADJSURV): if inall;
MPRINT(_ADJSURV): if count=. then count=0;
MPRINT(_ADJSURV): if s0^=. then ts0=s0;
MPRINT(_ADJSURV): else s0=ts0;
MPRINT(_ADJSURV): if s1_1^=. then ts1_1=s1_1;
MPRINT(_ADJSURV): else s1_1=ts1_1;
MPRINT(_ADJSURV): if s1_2^=. then ts1_2=s1_2;
MPRINT(_ADJSURV): else s1_2=ts1_2;
MPRINT(_ADJSURV): if s1_3^=. then ts1_3=s1_3;
MPRINT(_ADJSURV): else s1_3=ts1_3;
MPRINT(_ADJSURV): if s1_4^=. then ts1_4=s1_4;
MPRINT(_ADJSURV): else s1_4=ts1_4;
MPRINT(_ADJSURV): if s1_5^=. then ts1_5=s1_5;
MPRINT(_ADJSURV): else s1_5=ts1_5;
MPRINT(_ADJSURV): if s1_6^=. then ts1_6=s1_6;
MPRINT(_ADJSURV): else s1_6=ts1_6;
MPRINT(_ADJSURV): if s1_7^=. then ts1_7=s1_7;
MPRINT(_ADJSURV): else s1_7=ts1_7;
MPRINT(_ADJSURV): if s1_8^=. then ts1_8=s1_8;
MPRINT(_ADJSURV): else s1_8=ts1_8;
MPRINT(_ADJSURV): if s1_9^=. then ts1_9=s1_9;
MPRINT(_ADJSURV): else s1_9=ts1_9;
MPRINT(_ADJSURV): if s1_10^=. then ts1_10=s1_10;
MPRINT(_ADJSURV): else s1_10=ts1_10;
MPRINT(_ADJSURV): if s1_11^=. then ts1_11=s1_11;
MPRINT(_ADJSURV): else s1_11=ts1_11;
MPRINT(_ADJSURV): if s1_12^=. then ts1_12=s1_12;
MPRINT(_ADJSURV): else s1_12=ts1_12;
MPRINT(_ADJSURV): if s1_13^=. then ts1_13=s1_13;
MPRINT(_ADJSURV): else s1_13=ts1_13;
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: There were 34 observations read from the data set WORK.RISKSET3.
NOTE: There were 33 observations read from the data set WORK.DCOUNT3.
NOTE: The data set WORK.RISKSET3 has 166 observations and 16 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset3;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s0;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s1;
MPRINT(_ADJSURV): read all var{count} into count;
MPRINT(_ADJSURV): close riskset3;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(s0);
MPRINT(_ADJSURV): numcov=ncol(s1);
MPRINT(_ADJSURV): cumuhaz=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp=0;
MPRINT(_ADJSURV): wtemp=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp=ctemp+count[i]/s0[i];
MPRINT(_ADJSURV): wtemp=wtemp+count[i]/s0[i]/s0[i];
MPRINT(_ADJSURV): cumuhaz[i]=ctemp;
MPRINT(_ADJSURV): w1[i]=wtemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): adjsurv=j(numtime,1,0);
MPRINT(_ADJSURV): varsurv=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz=j(numtime,1,0);
MPRINT(_ADJSURV): fh=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv=exp(-cumuhaz)##expbz;
MPRINT(_ADJSURV): adjsurv=adjsurv+surv;
MPRINT(_ADJSURV): fexpbz=fexpbz+surv#expbz;
MPRINT(_ADJSURV): h=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]);
MPRINT(_ADJSURV): h[j,]=htemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh=fh+surv#h#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): adjsurv=adjsurv/numobs;
MPRINT(_ADJSURV): term1=(fexpbz##2)#w1;
MPRINT(_ADJSURV): term2=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term2[i]=fh[i,]*sigma*t(fh[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): varsurv=term1+term2;
MPRINT(_ADJSURV): varsurv=varsurv/numobs/numobs;
MPRINT(_ADJSURV): sesurv=varsurv##0.5;
MPRINT(_ADJSURV): outmat=time||adjsurv||sesurv;
MPRINT(_ADJSURV): names={'time' 'surv' 'se'};
MPRINT(_ADJSURV): create surv3 from outmat[colname=names];
MPRINT(_ADJSURV): append from outmat;
MPRINT(_ADJSURV): close surv3;
NOTE: The data set WORK.SURV3 has 166 observations and 3 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.59 seconds
cpu time 0.56 seconds
MPRINT(_ADJSURV): data riskset4;
MPRINT(_ADJSURV): set coxout (keep=time strata z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 zb);
MPRINT(_ADJSURV): where strata=4;
MPRINT(_ADJSURV): by descending time;
MPRINT(_ADJSURV): keep time s0 s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13;
MPRINT(_ADJSURV): s0+exp(zb);
MPRINT(_ADJSURV): s1_1+z1 * exp(zb);
MPRINT(_ADJSURV): s1_2+z2 * exp(zb);
MPRINT(_ADJSURV): s1_3+z3 * exp(zb);
MPRINT(_ADJSURV): s1_4+z4 * exp(zb);
MPRINT(_ADJSURV): s1_5+z5 * exp(zb);
MPRINT(_ADJSURV): s1_6+z6 * exp(zb);
MPRINT(_ADJSURV): s1_7+z7 * exp(zb);
MPRINT(_ADJSURV): s1_8+z8 * exp(zb);
MPRINT(_ADJSURV): s1_9+z9 * exp(zb);
MPRINT(_ADJSURV): s1_10+z10 * exp(zb);
MPRINT(_ADJSURV): s1_11+z11 * exp(zb);
MPRINT(_ADJSURV): s1_12+z12 * exp(zb);
MPRINT(_ADJSURV): s1_13+z13 * exp(zb);
MPRINT(_ADJSURV): if last.time;
MPRINT(_ADJSURV): run;
NOTE: There were 647 observations read from the data set WORK.COXOUT.
WHERE strata=4;
NOTE: The data set WORK.RISKSET4 has 128 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): proc sort data=riskset4;
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: There were 128 observations read from the data set WORK.RISKSET4.
NOTE: The data set WORK.RISKSET4 has 128 observations and 15 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): ODS LISTING CLOSE;
MPRINT(_ADJSURV): proc freq data=indata;
MPRINT(_ADJSURV): where strata=4 & event=1;
MPRINT(_ADJSURV): table time/out=dcount4;
MPRINT(_ADJSURV): run;
NOTE: There were 258 observations read from the data set WORK.INDATA.
WHERE (strata=4) and (event=1);
NOTE: The data set WORK.DCOUNT4 has 127 observations and 3 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.07 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): ODS LISTING;
MPRINT(_ADJSURV): data riskset4;
MPRINT(_ADJSURV): merge alltime (in=inall) riskset4 dcount4 (keep=time count);
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): drop ts:;
MPRINT(_ADJSURV): retain ts0 ts1_1 ts1_2 ts1_3 ts1_4 ts1_5 ts1_6 ts1_7 ts1_8 ts1_9 ts1_10
ts1_11 ts1_12 ts1_13 999;
MPRINT(_ADJSURV): if inall;
MPRINT(_ADJSURV): if count=. then count=0;
MPRINT(_ADJSURV): if s0^=. then ts0=s0;
MPRINT(_ADJSURV): else s0=ts0;
MPRINT(_ADJSURV): if s1_1^=. then ts1_1=s1_1;
MPRINT(_ADJSURV): else s1_1=ts1_1;
MPRINT(_ADJSURV): if s1_2^=. then ts1_2=s1_2;
MPRINT(_ADJSURV): else s1_2=ts1_2;
MPRINT(_ADJSURV): if s1_3^=. then ts1_3=s1_3;
MPRINT(_ADJSURV): else s1_3=ts1_3;
MPRINT(_ADJSURV): if s1_4^=. then ts1_4=s1_4;
MPRINT(_ADJSURV): else s1_4=ts1_4;
MPRINT(_ADJSURV): if s1_5^=. then ts1_5=s1_5;
MPRINT(_ADJSURV): else s1_5=ts1_5;
MPRINT(_ADJSURV): if s1_6^=. then ts1_6=s1_6;
MPRINT(_ADJSURV): else s1_6=ts1_6;
MPRINT(_ADJSURV): if s1_7^=. then ts1_7=s1_7;
MPRINT(_ADJSURV): else s1_7=ts1_7;
MPRINT(_ADJSURV): if s1_8^=. then ts1_8=s1_8;
MPRINT(_ADJSURV): else s1_8=ts1_8;
MPRINT(_ADJSURV): if s1_9^=. then ts1_9=s1_9;
MPRINT(_ADJSURV): else s1_9=ts1_9;
MPRINT(_ADJSURV): if s1_10^=. then ts1_10=s1_10;
MPRINT(_ADJSURV): else s1_10=ts1_10;
MPRINT(_ADJSURV): if s1_11^=. then ts1_11=s1_11;
MPRINT(_ADJSURV): else s1_11=ts1_11;
MPRINT(_ADJSURV): if s1_12^=. then ts1_12=s1_12;
MPRINT(_ADJSURV): else s1_12=ts1_12;
MPRINT(_ADJSURV): if s1_13^=. then ts1_13=s1_13;
MPRINT(_ADJSURV): else s1_13=ts1_13;
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.ALLTIME.
NOTE: There were 128 observations read from the data set WORK.RISKSET4.
NOTE: There were 127 observations read from the data set WORK.DCOUNT4.
NOTE: The data set WORK.RISKSET4 has 166 observations and 16 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset4;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s0;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s1;
MPRINT(_ADJSURV): read all var{count} into count;
MPRINT(_ADJSURV): close riskset4;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(s0);
MPRINT(_ADJSURV): numcov=ncol(s1);
MPRINT(_ADJSURV): cumuhaz=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp=0;
MPRINT(_ADJSURV): wtemp=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp=ctemp+count[i]/s0[i];
MPRINT(_ADJSURV): wtemp=wtemp+count[i]/s0[i]/s0[i];
MPRINT(_ADJSURV): cumuhaz[i]=ctemp;
MPRINT(_ADJSURV): w1[i]=wtemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): adjsurv=j(numtime,1,0);
MPRINT(_ADJSURV): varsurv=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz=j(numtime,1,0);
MPRINT(_ADJSURV): fh=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv=exp(-cumuhaz)##expbz;
MPRINT(_ADJSURV): adjsurv=adjsurv+surv;
MPRINT(_ADJSURV): fexpbz=fexpbz+surv#expbz;
MPRINT(_ADJSURV): h=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp=htemp + count[j]/s0[j]*(zmat[i,]-s1[j,]/s0[j]);
MPRINT(_ADJSURV): h[j,]=htemp;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh=fh+surv#h#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): adjsurv=adjsurv/numobs;
MPRINT(_ADJSURV): term1=(fexpbz##2)#w1;
MPRINT(_ADJSURV): term2=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term2[i]=fh[i,]*sigma*t(fh[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): varsurv=term1+term2;
MPRINT(_ADJSURV): varsurv=varsurv/numobs/numobs;
MPRINT(_ADJSURV): sesurv=varsurv##0.5;
MPRINT(_ADJSURV): outmat=time||adjsurv||sesurv;
MPRINT(_ADJSURV): names={'time' 'surv' 'se'};
MPRINT(_ADJSURV): create surv4 from outmat[colname=names];
MPRINT(_ADJSURV): append from outmat;
MPRINT(_ADJSURV): close surv4;
NOTE: The data set WORK.SURV4 has 166 observations and 3 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.63 seconds
cpu time 0.71 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset1;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset1;
MPRINT(_ADJSURV): use riskset2;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset2;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov12 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov12;
NOTE: The data set WORK.COV12 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.14 seconds
cpu time 1.12 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset1;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset1;
MPRINT(_ADJSURV): use riskset3;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset3;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov13 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov13;
NOTE: The data set WORK.COV13 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.19 seconds
cpu time 1.14 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset1;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset1;
MPRINT(_ADJSURV): use riskset4;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset4;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov14 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov14;
NOTE: The data set WORK.COV14 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.19 seconds
cpu time 1.26 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset2;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset2;
MPRINT(_ADJSURV): use riskset3;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset3;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov23 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov23;
NOTE: The data set WORK.COV23 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.18 seconds
cpu time 1.23 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset2;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset2;
MPRINT(_ADJSURV): use riskset4;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset4;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov24 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov24;
NOTE: The data set WORK.COV24 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.20 seconds
cpu time 1.14 seconds
MPRINT(_ADJSURV): proc iml;
NOTE: IML Ready
MPRINT(_ADJSURV): use riskset3;
MPRINT(_ADJSURV): read all var{time} into time;
MPRINT(_ADJSURV): read all var{s0} into s01;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s11;
MPRINT(_ADJSURV): read all var{count} into count1;
MPRINT(_ADJSURV): close riskset3;
MPRINT(_ADJSURV): use riskset4;
MPRINT(_ADJSURV): read all var{s0} into s02;
MPRINT(_ADJSURV): read all var{ s1_1 s1_2 s1_3 s1_4 s1_5 s1_6 s1_7 s1_8 s1_9 s1_10 s1_11 s1_12
s1_13} into s12;
MPRINT(_ADJSURV): read all var{count} into count2;
MPRINT(_ADJSURV): close riskset4;
MPRINT(_ADJSURV): use best;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into b;
MPRINT(_ADJSURV): close best;
MPRINT(_ADJSURV): use sigma;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into sigma;
MPRINT(_ADJSURV): close sigma;
MPRINT(_ADJSURV): use indata;
MPRINT(_ADJSURV): read all var{ z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13} into zmat;
MPRINT(_ADJSURV): close indata;
MPRINT(_ADJSURV): numtime=nrow(time);
MPRINT(_ADJSURV): numobs=nrow(zmat);
MPRINT(_ADJSURV): numcov=ncol(s11);
MPRINT(_ADJSURV): cumuhaz1=j(numtime,1,0);
MPRINT(_ADJSURV): cumuhaz2=j(numtime,1,0);
MPRINT(_ADJSURV): w1=j(numtime,1,0);
MPRINT(_ADJSURV): w2=j(numtime,1,0);
MPRINT(_ADJSURV): ctemp1=0;
MPRINT(_ADJSURV): ctemp2=0;
MPRINT(_ADJSURV): wtemp1=0;
MPRINT(_ADJSURV): wtemp2=0;
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): ctemp1=ctemp1+count1[i]/s01[i];
MPRINT(_ADJSURV): ctemp2=ctemp2+count2[i]/s02[i];
MPRINT(_ADJSURV): wtemp1=wtemp1+count1[i]/s01[i]/s01[i];
MPRINT(_ADJSURV): wtemp2=wtemp2+count2[i]/s02[i]/s02[i];
MPRINT(_ADJSURV): cumuhaz1[i]=ctemp1;
MPRINT(_ADJSURV): cumuhaz2[i]=ctemp2;
MPRINT(_ADJSURV): w1[i]=wtemp1;
MPRINT(_ADJSURV): w2[i]=wtemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fexpbz1=j(numtime,1,0);
MPRINT(_ADJSURV): fexpbz2=j(numtime,1,0);
MPRINT(_ADJSURV): fh2_fh1=j(numtime,numcov,0);
MPRINT(_ADJSURV): do i=1 to numobs;
MPRINT(_ADJSURV): expbz=exp(zmat[i,]*t(b));
MPRINT(_ADJSURV): surv1=exp(-cumuhaz1)##expbz;
MPRINT(_ADJSURV): surv2=exp(-cumuhaz2)##expbz;
MPRINT(_ADJSURV): fexpbz1=fexpbz1+surv1#expbz;
MPRINT(_ADJSURV): fexpbz2=fexpbz2+surv2#expbz;
MPRINT(_ADJSURV): h1=j(numtime,numcov,0);
MPRINT(_ADJSURV): h2=j(numtime,numcov,0);
MPRINT(_ADJSURV): htemp1=j(1, numcov, 0);
MPRINT(_ADJSURV): htemp2=j(1, numcov, 0);
MPRINT(_ADJSURV): do j=1 to numtime;
MPRINT(_ADJSURV): htemp1=htemp1 + count1[j]/s01[j]*(zmat[i,]-s11[j,]/s01[j]);
MPRINT(_ADJSURV): htemp2=htemp2 + count2[j]/s02[j]*(zmat[i,]-s12[j,]/s02[j]);
MPRINT(_ADJSURV): h1[j,]=htemp1;
MPRINT(_ADJSURV): h2[j,]=htemp2;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): fh2_fh1=fh2_fh1+surv2#h2#expbz-surv1#h1#expbz;
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): term1=(fexpbz1##2)#w1;
MPRINT(_ADJSURV): term2=(fexpbz2##2)#w2;
MPRINT(_ADJSURV): term3=j(numtime,1,0);
MPRINT(_ADJSURV): do i=1 to numtime;
MPRINT(_ADJSURV): term3[i]=fh2_fh1[i,]*sigma*t(fh2_fh1[i,]);
MPRINT(_ADJSURV): end;
MPRINT(_ADJSURV): covar=term1+term2+term3;
MPRINT(_ADJSURV): covar=covar/numobs/numobs;
MPRINT(_ADJSURV): cov=covar##0.5;
MPRINT(_ADJSURV): names={'se'};
MPRINT(_ADJSURV): create cov34 from cov[colname=names];
MPRINT(_ADJSURV): append from cov;
MPRINT(_ADJSURV): close cov34;
NOTE: The data set WORK.COV34 has 166 observations and 1 variables.
MPRINT(_ADJSURV): run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
MPRINT(_ADJSURV): quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 1.14 seconds
cpu time 1.12 seconds
MPRINT(_ADJSURV): data mout;
MPRINT(_ADJSURV): merge surv1 (rename=(surv=surv1 se=se1)) surv2 (rename=(surv=surv2 se=se2))
surv3 (rename=(surv=surv3 se=se3)) surv4 (rename=(surv=surv4 se=se4)) cov12 (rename=(se=se12))
cov13 (rename=(se=se13)) cov14 (rename=(se=se14)) cov23 (rename=(se=se23)) cov24
(rename=(se=se24)) cov34 (rename=(se=se34));
MPRINT(_ADJSURV): run;
NOTE: There were 166 observations read from the data set WORK.SURV1.
NOTE: There were 166 observations read from the data set WORK.SURV2.
NOTE: There were 166 observations read from the data set WORK.SURV3.
NOTE: There were 166 observations read from the data set WORK.SURV4.
NOTE: There were 166 observations read from the data set WORK.COV12.
NOTE: There were 166 observations read from the data set WORK.COV13.
NOTE: There were 166 observations read from the data set WORK.COV14.
NOTE: There were 166 observations read from the data set WORK.COV23.
NOTE: There were 166 observations read from the data set WORK.COV24.
NOTE: There were 166 observations read from the data set WORK.COV34.
NOTE: The data set WORK.MOUT has 166 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): data data.coxout;
MPRINT(_ADJSURV): time=0;
MPRINT(_ADJSURV): surv1=1;
MPRINT(_ADJSURV): se1=0;
MPRINT(_ADJSURV): se12=0;
MPRINT(_ADJSURV): se13=0;
MPRINT(_ADJSURV): se14=0;
MPRINT(_ADJSURV): surv2=1;
MPRINT(_ADJSURV): se2=0;
MPRINT(_ADJSURV): se23=0;
MPRINT(_ADJSURV): se24=0;
MPRINT(_ADJSURV): surv3=1;
MPRINT(_ADJSURV): se3=0;
MPRINT(_ADJSURV): se34=0;
MPRINT(_ADJSURV): surv4=1;
MPRINT(_ADJSURV): se4=0;
MPRINT(_ADJSURV): output;
MPRINT(_ADJSURV): run;
NOTE: Data file DATA.COXOUT.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used,
which might require additional CPU resources and might reduce performance.
NOTE: The data set DATA.COXOUT has 1 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
MPRINT(_ADJSURV): data data.coxout;
MPRINT(_ADJSURV): set data.coxout mout;
NOTE: Data file DATA.COXOUT.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used,
which might require additional CPU resources and might reduce performance.
MPRINT(_ADJSURV): by time;
MPRINT(_ADJSURV): run;
NOTE: Data file DATA.COXOUT.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used,
which might require additional CPU resources and might reduce performance.
NOTE: There were 1 observations read from the data set DATA.COXOUT.
NOTE: There were 166 observations read from the data set WORK.MOUT.
NOTE: The data set DATA.COXOUT has 167 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
Thank you again!
WARNING: Some character data was lost during transcoding in the dataset DATA.COX. Either the data contains characters that are not representable in the new encoding or truncation occurred during transcoding.
This implies that the character encoding of the data set is different.
Please run the following program to reveal what the encoding is.
proc contents data=data.cox;
run;
and show this results.
Thank you Kawakami. I have run the following code.
proc contents data=data.cox;
run;
The result is
Encoding shift-jis Japanese (SJIS)
Thank you again!
Then you may submit program in "SAS 9.4(日本語)"
Thank you Kawakami. As you said, I mainly use the "SAS 9.4(日本語)" to write SAS program, do that affect the macro running?
How can I fix it?
Thank you again!
It has nothing to do with the execution of the macro. It affects the encoding of the data set.
The dataset you are using now is Shift-JIS, which means it may be created in a SAS Japanese environment, so there is a high possibility that SAS will not be processed correctly unless it is also a Japanese version.
If you are running SAS using the English version, please try running it using the Japanese version.
Thank you Kawakami. I try to run it using the Japanese version. As you said, the warning do not come out. However, the result is not as the paper said. Maybe it is due to the commented out 2 lines. I will contact the authors to see if there is a solution.
Thank you again.
The log:
1 %require(&data &time &event &group &out &x) - 180 WARNING: Apparent invocation of macro REQUIRE not resolved. WARNING: Apparent invocation of macro _LIST not resolved.
complains about a macro called %REQUIRE, but the code as posted:
%_require(&data &time &event &group &out &x)
calls a macro called %_REQUIRE. So your log does not come from the code as posted.
As @Kurt_Bremser said, the code and the log don't match. How can we help if you give incorrect information?
Try commenting out the 2 lines. %require seems to be a macro that checks that the variables are provided, and I am unsure what %list does, it might be mundane as well.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.