BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EricCai
Calcite | Level 5

Dear Community,

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

Number of Observations Read        2565

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

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

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
EricCai
Calcite | Level 5

This was very helpful - thanks, PGStats!

JacobSimonsen
Barite | Level 11

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;
Alddle
Fluorite | Level 6

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

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 6865 views
  • 5 likes
  • 4 in conversation