Question about indicator coding

Reply
Occasional Contributor
Posts: 8

Question about indicator coding

Hi everyone,

I'm currently working with a dataset and created 4 quartiles using proc rank called education4. What I'm trying to do next is create indicator variables from those quartiles.

The quartiles according to proc rank are 0,1,2,3

Here is my code:

if education4=0 then ed1=1; else ed1=0;

if education4=1 then ed2=1; else ed2=0;

if education4=2 then ed3=1; else ed3=0;

if education4=3 then ed4=1; else ed4=0;

ed1 ed2 ed3 ed4 are obviously the indicator variables that i'm trying to create with ed1 being what would be known as the reference level. However, when I try to run proc logistic which only includes ed2 ed3 and ed4 i don't get an error message but rather something that says the following parameters have been set to 0, since the variables are a linear combination of other variables as shown.

SAS then tells me the parameter estimates for ed2 ed3 and ed4 are all 0 which isn't what i'm looking for.

Can anyone tell me what this all means? and how I can correct for this so I get the actual parameter estimates? Thanks!

Super User
Posts: 11,343

Re: Question about indicator coding

Posted in reply to xkountrydude

Probably would be a good idea to post your proc logistic code.

Occasional Contributor
Posts: 8

Re: Question about indicator coding

sure

proc logistic;

model diet_3yrs = ed2 ed3 ed4/rl;

run;

Super User
Posts: 19,877

Re: Question about indicator coding

Posted in reply to xkountrydude

Is that the exact code you submitted? You don't have to have data=, but I find it helpful for debugging especially.

Run a proc freq as follows and see what comes up, post if possible:

proc freq data=have;

table ed2*ed3*ed4/list;

run;

EDIT:

Your proc logistic code should also be equivalent to

proc logistic data=have;

class education4/param=ref ref=first;

model diet_yrs=education4;

run;

Occasional Contributor
Posts: 8

Re: Question about indicator coding

yeah i have done proc freq before but every single time i get 0's for each group

Super User
Posts: 19,877

Re: Question about indicator coding

Posted in reply to xkountrydude

Then that's why SAS is giving you the estimates it is. There's something wrong somewhere then but with what you've provided we can't tell you.

Occasional Contributor
Posts: 8

Re: Question about indicator coding

I don't know what more I can provide you with would actual output help?

Super User
Posts: 19,877

Re: Question about indicator coding

Posted in reply to xkountrydude

Post your full code including your recoding steps, your log from the submitted code, and a proc freq from education4.

Occasional Contributor
Posts: 8

Re: Question about indicator coding

Nevermind I actually got everything to work. Turns out I didn't create a permanent dataset and that was messing everything up.

Ask a Question
Discussion stats
  • 8 replies
  • 312 views
  • 0 likes
  • 3 in conversation