turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Identifying Unused Observations in PROC PHREG

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2014 10:11 PM

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

Accepted Solutions

Solution

05-03-2014
10:58 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2014 10:58 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-03-2014 10:58 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-07-2014 09:44 PM

This was very helpful - thanks, PGStats!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-18-2016 04:55 AM

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-17-2016 04:13 AM - edited 11-17-2016 04:16 AM

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