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
Obsidian | Level 7

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;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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