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

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
Rick_SAS
SAS Super FREQ

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.

View solution in original post

9 REPLIES 9
Rick_SAS
SAS Super FREQ

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.

lei
Obsidian | Level 7 lei
Obsidian | Level 7

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.

 

 

Rick_SAS
SAS Super FREQ

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.

 

lei
Obsidian | Level 7 lei
Obsidian | Level 7

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.

 

 

Rick_SAS
SAS Super FREQ

 

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.

lei
Obsidian | Level 7 lei
Obsidian | Level 7

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?


Capture.PNG
lei
Obsidian | Level 7 lei
Obsidian | Level 7

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.


kkk.png
Rick_SAS
SAS Super FREQ

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

lei
Obsidian | Level 7 lei
Obsidian | Level 7

Got it thank you!

sas-innovate-2024.png

 

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. 

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 3709 views
  • 1 like
  • 2 in conversation