proc surveylogistic data =newnsch3a;
class sex (ref = '0') race(Ref = '0') FPL (ref= '0') smokes(Ref= '0') adulteducate (ref='0')
family (ref='0') sleep (ref='0') comp (ref='0') age3_1718 (ref='2') MOLD (ref='2')
exercise (ref='0') pest (ref='0')/param=glm ;
strata Fipsst;
cluster hhid;
weight fwc;
Model ast (event ='1') = age3_1718 sex race FPL smokes comp adulteducate
MOLD exercise pest family sleep smokes*comp;
lsmeans smokes*comp/oddsratio cl diff;
slice smokes*comp/ sliceby=comp diff=control('0' '0') oddsratio cl;
run;
Hello statisticians,
I am interested in finding the P for trend for the Odd Ratios (OR) that i got from the interaction between smoking and a composite variable that i created. Composite is a variable that has 4 level (0,1,2,3) while smokes have 2 levels (0,1). The interaction between composite and smokes was significant. So i have 4 ORs. My problem is that i would like to get a P for trend on these 4 ORs. Is there any other syntax that i should add to my code (above) to enable me get a P-value for the trend?
You can get a trend on the log-odds values working from the LSMEANS statement. I think the lsmeans will have the log odds for the 4 levels of comp at smokes=0, followed by the log odds for the four levels of comp at smokes=1. If that is the case, the following LSMESTIMATE statement will give the tests in the LOG ODDS space.
lsmestimate smokes*comp 'Trend due to comp for smokes=0' -3 -1 1 3 0 0 0 0,
'Trend due to comp for smokes=1' 0 0 0 0 -3 -1 1 3,
'Difference in trends' -3 -1 1 3 3 1 -1 -3;
Of course if the ordering of the smokes*comp lsmeans is different than what I supposed, these will have to be adjusted.
SteveDenham
You can get a trend on the log-odds values working from the LSMEANS statement. I think the lsmeans will have the log odds for the 4 levels of comp at smokes=0, followed by the log odds for the four levels of comp at smokes=1. If that is the case, the following LSMESTIMATE statement will give the tests in the LOG ODDS space.
lsmestimate smokes*comp 'Trend due to comp for smokes=0' -3 -1 1 3 0 0 0 0,
'Trend due to comp for smokes=1' 0 0 0 0 -3 -1 1 3,
'Difference in trends' -3 -1 1 3 3 1 -1 -3;
Of course if the ordering of the smokes*comp lsmeans is different than what I supposed, these will have to be adjusted.
SteveDenham
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.