Solved
Contributor
Posts: 40

# Identifying Unused Observations in PROC PHREG

Dear Community,

When I run PROC PHREG on my data set, I get the following output:

Number of Observations Used        2487

I want to see the unused observations; I'm guessing that there were missing values in at least 1 of the variables in those observations.

I have been told that there is no way to do this within PROC PHREG, so I have to do this with PROC FREQ or PROC PRINT.

My questions:

1) How can I display the observations that were NOT used in PROC PHREG?

2) Is there any way to make PROC FREQ/PRINT "talk" to PROC PHREG?

Thanks,

Eric

Accepted Solutions
Solution
‎05-03-2014 10:58 PM
Posts: 5,052

## Re: Identifying Unused Observations in PROC PHREG

Use the fact that residuals cannot be calculated for unused observations. Try adding the statement

output out=resOut resmart=resmart;

to the phreg procedure, and then

proc print data=resOut; where resmart is missing; run;

PG

PG

All Replies
Solution
‎05-03-2014 10:58 PM
Posts: 5,052

## Re: Identifying Unused Observations in PROC PHREG

Use the fact that residuals cannot be calculated for unused observations. Try adding the statement

output out=resOut resmart=resmart;

to the phreg procedure, and then

proc print data=resOut; where resmart is missing; run;

PG

PG
Contributor
Posts: 40

## Re: Identifying Unused Observations in PROC PHREG

This was very helpful - thanks, PGStats!

Super Contributor
Posts: 301

## Re: Identifying Unused Observations in PROC PHREG

I like that simple solution for finding unused observations. But, it is possible that unused observations will not have missing value in the residual. If an observation is the only one in a riskset, and it doesnt contribute to any other risksets, then the residual is zero and not missing.

``````data test;
a=0; strata=0;
do t=1,3,5;output;end;
a=1;
do t=2,4,6; if t=6 then strata=1; output; end;
run;

proc phreg data=test;
model  t=a;
strata strata;
output out=resOut resmart=resmart;
run;``````
Occasional Contributor
Posts: 8

## Re: Identifying Unused Observations in PROC PHREG

[ Edited ]

Dear PG, thanks a lot!

I have tried your suggestion in the Fine and gray model, and the log states that NOTE: The RESMART= option (OUTPUT statement) is ignored for the Fine and Gray competing-risks analysis.

My dataset has no missing value. However, my situation is that when the univeriate analysis was taken, everything is OK (the number of used observations = the number of read observations). But when the multivariate model was analized, things would be like this, as below:

ods graphics on;
proc phreg data=model_os_m plots(overlay=stratum)=cif;
class A (ref='Normal');
class B(order=internal ref=first) C(order=internal ref=first);
model dftime*status(0)=A B C D / eventcode=1;
Hazardratio 'Pairwise' A / diff=pairwise;
baseline covariates=cov_os2_m out=outos2m cif=_all_;
output out=resOut resmart=resmart;
run;

NOTE: 331 observations were deleted due either to missing or invalid values for the time,
censoring, frequency or explanatory variables or to invalid operations in generating the
values for some of the explanatory variables.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.

Could you please tell me how can I solve this problem in fine and gray model test?

Thank you very much!

Yi

☑ This topic is solved.