Turn on suggestions

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

Showing results for

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

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 05-24-2016 02:28 PM
(3708 views)

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

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Got it thank you!

⏰

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.** **

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.