Help using Base SAS procedures

Output covariates from proc phreg not working

Accepted Solution Solved
Reply
Contributor lei
Contributor
Posts: 37
Accepted Solution

Output covariates from proc phreg not working

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
SAS Super FREQ
Posts: 3,478

Re: Output covariates from proc phreg not working

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


All Replies
Solution
‎05-24-2016 05:12 PM
SAS Super FREQ
Posts: 3,478

Re: Output covariates from proc phreg not working

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.

Contributor lei
Contributor
Posts: 37

Re: Output covariates from proc phreg not working

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.

 

 

SAS Super FREQ
Posts: 3,478

Re: Output covariates from proc phreg not working

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.

 

Contributor lei
Contributor
Posts: 37

Re: Output covariates from proc phreg not working

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.

 

 

SAS Super FREQ
Posts: 3,478

Re: Output covariates from proc phreg not working

 

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.

Contributor lei
Contributor
Posts: 37

Re: Output covariates from proc phreg not working

[ Edited ]

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
Contributor lei
Contributor
Posts: 37

Re: Output covariates from proc phreg not working

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
SAS Super FREQ
Posts: 3,478

Re: Output covariates from proc phreg not working

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

Contributor lei
Contributor
Posts: 37

Re: Output covariates from proc phreg not working

Got it thank you!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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