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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Output covariates from proc phreg not working

- 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-24-2016 02:28 PM

Hi,

I'm running the codes below in order get an output of the covariates. However, I keep on getting the error below.

PROC PHREG DATA=CRC.FINAL10;

MODEL DAYS_BTWN_SURG1DEATH*DIED(0)=WAIT1 FEMALE AGE STAGECATUNK STAGECAT3 COMORMISS1 CHEMO_NUMCAT /RL;

BASELINE OUT=YROUT LOWER=LOW_CI UPPER=UP_CI COVARIATES=SAMPLE SURVIVAL=SURV/ALPHA=0.05 NOMEAN;

RUN;

ERROR: File WORK.SAMPLE.DATA does not exist.

Does anyone know why this is happening?

Thank you.

Shirley

Accepted Solutions

Solution

05-24-2016
05:12 PM

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

05-24-2016 02:37 PM

The COVARIATES= option on the BASELINE statement is supposed to point to a SAS data set. The error is saying that the data set WORK.Sample does not exist.

By the way, I assume that FEMALE is a categorical variable. If so, you might want to add FEMALE to a CLASS statement. If there are other classification variables in the model, those should also be added to the CLASS statement.

All Replies

Solution

05-24-2016
05:12 PM

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

05-24-2016 02:37 PM

The COVARIATES= option on the BASELINE statement is supposed to point to a SAS data set. The error is saying that the data set WORK.Sample does not exist.

By the way, I assume that FEMALE is a categorical variable. If so, you might want to add FEMALE to a CLASS statement. If there are other classification variables in the model, those should also be added to the CLASS statement.

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

05-24-2016 02:38 PM

Hi,

All the categorical variables have been converted to dummy. Would this affect the output?

I understand that it says the work.sample does not exist. Is it suppose to create the datasest work if it doesn't exist in this case? or am I suppose to create it first?

Thanks.

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

05-24-2016 02:55 PM

You are supposed to create it. The "Getting Started" example in the doc shows what should be in the data set. You can also omit that option. In that case, the proc will output the requested statistics at the reference levels for the CLASS variables and at the mean value the continuous variables.

I would advise using the CLASS statement. As you see from the previous paragraph, the BASELINE statement treats CLASS and continuous variables differently. If "males" are the reference level, then

1) If FEMALE is a class variable, then the output statistics will be generated for the reference level, perhaps FEMALE=0.

2) If FEMALE is a continuous variable, then the output statistics will be generated for the average level, which could be 0.5 or some other fractional value. Evaluating the model at FEMALE=0.5 is probably not what you want.

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

05-24-2016 04:07 PM

Hi Rick,

Thank you so much. I see what you mean. I also got it to work. However, I'm trying to recreate Figure 2 from the SAS proceeding http://support.sas.com/resources/papers/proceedings09/236-2009.pdf . Figure 2 is on page 6 and titled " Visualizing the impact of age (years) as continuous covariate on estimated 5-years primary outcome with 95% confidence interval by gender group.". I am not getting the graph at all.

Does anyone know how they to re-produce the figure?

Thanks.

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

05-24-2016 04:27 PM

Well, you could do it by hand like they do, but if you are using a modern version of SAS, try this:

1) Use the STORE statement in PROC PHREG to write the model to an item store.

2) Use the EFFECTPLOT statement in PROC PLM to create the plot. The doc shows many examples. their examlp[e might look something like this (untested)

effectplot slicefit(x=age sliceby=sex);

For more complex models, you'll want to use the AT= option on the EFFECTPLOT statement to specify the value for the other independent variables. For additional examples, see Downer 2013.

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

05-24-2016 05:13 PM - edited 05-24-2016 05:15 PM

Thank you Rick. I never knew about the proc plm. I am trying it out. I am wondering for proc phreg, can proc plm be used for the diagram attached where I am trying to model the ln(hazard ratio) versus age?

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

05-24-2016 06:26 PM

Hi Rick,

Here's my model:

PROC PHREG DATA = CRC.FINAL10;

CLASS STAGE2 (ref='II')/PARAM=REFERENCE;

MODEL DAYS_BTWN_SURG1DEATH*DIED(0) = WAIT1 STAGE2;

STORE OUT=CRC.WAIT_SURVIVAL;

RUN;

ODS GRAPHICS ON;

PROC PLM RESTORE=CRC.WAIT_SURVIVAL;

EFFECTPLOT SLICEFIT(X=WAIT1 SLICEBY=STAGE2);

RUN;

I got the graph below. It doesn't look right. I'm really sorry. I have never used proc plm am a little confused by it.

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

05-24-2016 06:45 PM

'm sure that by reading the doc and experimenting you'll have the plot you want very soon. Good luck.

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

05-29-2016 08:07 PM

Got it thank you!