BookmarkSubscribeRSS Feed
katy-barry
Calcite | Level 5

hello, I am trying to test for an interaction between a categorical variable and my main exposure variable (also categorical). I have tried so many combinations to try to get the odds ratios for the interaction term. can someone please help me:

 

Class Level Information

Class

Value

Design Variables

earlystart

0

0

0

 

1

1

0

 

2

0

1

 

 

 

 

repeat1

0

0

 

 

1

1

 

 

Parameter Information

Parameter

Effect

earlystart

repeat1

Prm1

Intercept

 

 

Prm2

earlystart

1

 

Prm3

earlystart

2

 

Prm4

repeat1

 

1

Prm5

earlystart*repeat1

1

1

Prm6

earlystart*repeat1

2

1

 

 

 

proc genmod data= final_chomage_dernier;

class ntt chomage_dernier (param=ref ref= '0') 

earlystart(param=ref ref= '0') repeat1 (param=ref ref='0');

model chomage_dernier= earlystart repeat1 earlystart*repeat1/ dist=bin link=logit;

repeated subject=ntt/ type=unstr;

estimate "repeat 1" repeat1 1/exp;

estimate "earlystart*repeat" earlystart*repeat1 1 1 /exp;

estimate "earlystart*repeat" earlystart*repeat1 0 1 /exp;

run;

 

thank you!

1 REPLY 1
cminard
Quartz | Level 8

You're not specifying enough parameters in the estimate statements. I did a simulation to demonstrate. I guess you have repeated measures, but I ignored that. I am assuming independent observations in my example. But the estimate statements should be similar.

 

I set this up so that the odds of an event in earlystart2 should be about 6x greater than the odds of an event in earlystart0 and earlystart1.

 

data one;
do earlystart=0 to 2;
do repeat1=0 to 1;
do n = 1 to 1000;
if earlystart in (0,1) then event=1*(ranuni(133)<.2);
if earlystart=2 then event=1*(ranuni(6113)<.6);
output;
end;
end;
end;
run;

data two;
set one (drop=n);
id+1;
run;

proc genmod data=two;
class event earlystart (ref='0') repeat1 (ref='0');
model event (event='1') = earlystart|repeat1 / dist=bin link=logit ;
estimate 'earlystart1 vs. earlystart0' int 0 earlystart 1 0 -1 repeat1 0 0 earlystart*repeat1 .5 .5 0 0 -.5 -.5 / exp;
estimate 'earlystart2 vs. earlystart0' int 0 earlystart 0 1 -1 repeat1 0 0 earlystart*repeat1 0 0 .5 .5 -.5 -.5 / exp;
estimate 'earlystart2 vs. earlystart1' int 0 earlystart -1 1 0 repeat1 0 0 earlystart*repeat1 -.5 -.5 .5 .5 0 0 / exp;
run;

 

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1050 views
  • 0 likes
  • 2 in conversation