Help using Base SAS procedures

set reference group for categorical variable in proc lifereg

Reply
Occasional Contributor
Posts: 15

set reference group for categorical variable in proc lifereg

Hi folks,

I found myself lost in setting a baseline reference group for a categorical variable in my model of parametric survival analysis.

There are 6 categories in priorarrests variable, coded in value 1 to 6. I want to use 2, the second group as my baseline. 

This is my code

proc lifereg data= roads.onlyrecordslessthan12 outest=weiboutest;
class race_group gender_group marital_group famprb0new priorarrests (ref="2");
model survivaltime*censor_1(1) =priorarrests impulsivetemperment school0 age
gender_group race_group famprb0new marital_group/distribution=lnormal;
title 'Weibull regression for the data';
output out=weibsurv xbeta=weib_xb;
run;

The log shows

10 proc lifereg data= roads.onlyrecordslessthan12 outest=weiboutest;
11 class race_group gender_group marital_group famprb0new priorarrests (ref="2");
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.
12 model survivaltime*censor_1(1) =priorarrests impulsivetemperment school0 age
13 gender_group race_group famprb0new marital_group/distribution=lnormal;
14 title 'Weibull regression for the data';
15 output out=weibsurv xbeta=weib_xb;
16 run;

 

I tried using no quotation marks as this

priorarrests (ref=2);

But the log still gives error message.

17 proc lifereg data= roads.onlyrecordslessthan12 outest=weiboutest;
18 class race_group gender_group marital_group famprb0new priorarrests (ref=2);
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.
19 model survivaltime*censor_1(1) =priorarrests impulsivetemperment school0 age
20 gender_group race_group famprb0new marital_group/distribution=lnormal;
21 title 'Weibull regression for the data';
22 output out=weibsurv xbeta=weib_xb;
23 run;

 

Anyone could help me?

Thank you!

 

 

SAS Super FREQ
Posts: 4,237

Re: set reference group for categorical variable in proc lifereg

If you read the PROC LIFEREG documentation, you will see that PROC LIFEREG does not support that syntax. The doc says that you can use PROC FORMAT to determine the reference level in conjunction with the ORDER= option on the PROC LIFEREG statement. For examples and further discussion of how to set the reference level, see the last two examples in the Usage Note "Setting the reference levels for the CLASS predictor variables."

Ask a Question
Discussion stats
  • 1 reply
  • 142 views
  • 0 likes
  • 2 in conversation