## Parameter estimates

Occasional Contributor
Posts: 18

# Parameter estimates

Hi everyone,

so i'm working with a dataset that has the variable called hisugbev (high sugared beverage intake in servings/week). I'm trying to create a categorical variable with four levels and then create indicator variables from this categorical variable. For some reason after I create the categorical variable and the indicator variables, when I run my model for one of the parameter estimates i get a value of 0 and 0 d.f. Could anyone tell me what the reason might be for that?

This is my code below that may help:

if hisugbev=0 then sweet=1;

else if 0 gt hisugbev lt 1 then sweet=2;

else if 1 ge hisugbev le 3 then sweet=3;

else if 3 gt hisugbev then sweet=4;

if sweet=1 then sugar1=1; else sugar1=0;

if sweet=2 then sugar2=1; else sugar2=0;

if sweet=3 then sugar3=1; else sugar3=0;

if sweet=4 then sugar4=1; else sugar4=0;

proc phreg;

class sweet (param=ref ref='1');

model tpyrs*c5_1(0) = age sugar2 sugar3 sugar4;

run;

I get parameter estimates for sugar3 and sugar4 but not sugar2.

Super User
Posts: 20,785

## Re: Parameter estimates

ie

proc freq data=have;

table hisugbev*sweet;

run;

It's a good habit to always check your coding.

3 GT highsugbev

3>highsugbev.

It should be hisugbev>3

Occasional Contributor
Posts: 18

## Re: Parameter estimates

Ok so I did run proc freq and sweet=2 isn't even on the right hand side of the table...only 1,3,4

Super User
Posts: 20,785

## Re: Parameter estimates

Yup, that's what I've got as well.

If your variables are whole numbers, not decimals then 0 to 1 will never be coded because the boundaries aren't included.

Occasional Contributor
Posts: 18

## Re: Parameter estimates

Haha yes you're right! I got parameter estimates for sweet=2,3,and 4. That is so strange though...SAS doesn't know that .5 is between 0 and 1? Thank you so much for pointing this out to me!

Super User
Posts: 20,785

## Re: Parameter estimates

Actually, its my mistake, because at first glance they appear correct but I believe your boundaries are wrong, SAS does know how to categorize things properly. You should only have gt in the last condition.

data have;

do hisugbev=0 to 18 by 0.5;

output;

end;

run;

data want;

set have;

if hisugbev=0 then sweet=1;

else if 0<hisugbev<1 then sweet=2;

else if 1<=hisugbev <=3 then sweet=3;

else if hisugbev>3 then sweet=4;

run;

proc freq data=want;

table hisugbev*sweet/missing;

run;

Occasional Contributor
Posts: 18

## Re: Parameter estimates

Yup that's what I ended up doing when I changed my endpoints the only one I have gt for is in the last condition.

Occasional Contributor
Posts: 18

## Re: Parameter estimates

I don't get it...the coding for sweet=2 should work and it isn't like there are no observations in my dataset that don't fall under that condition, there definitely are. I checked all of that out earlier.

Discussion stats
• 7 replies
• 373 views
• 1 like
• 2 in conversation