BookmarkSubscribeRSS Feed
9 REPLIES 9
ChrisNZ
Tourmaline | Level 20

Welcome to the SAS community Simone.

I can't answer your question, but I have a comment about the format.

I reckon that you should protect your identity a bit better.

I would not publish my email address and phone number like this.

Just my (paranoid) 2 cents of course. 🙂

 

Also, you should format your code when posting it here. There are 2 icons to do that: running man and {i}.

Ksharp
Super User

Better post this kind of question at STAT forum.   @StatDave  @Rick_SAS  could give you a hand.

ChrisNZ
Tourmaline | Level 20

Or your phone number being on all the calling robots' lists.
Don't help the privacy invaders. Resist.

ChrisNZ
Tourmaline | Level 20

I reckon you can remove the last line of your signature Kurt, now that your (good) proposal has been mothballed.

I wonder how many Ballot ideas are closed with status IMPLEMENTED? Are there any?

Rick_SAS
SAS Super FREQ

There is a SAS Knowledge Base article about writing contrast statements that involve interactions.

I assume the levels of Migraine are 0 and 1.

What are the levels (and interpretation) of the Age variable? 

 

mone
Calcite | Level 5

 

I spent many hours trying to understand why my contrast statement gives a different OR compared to the proc sort statement. I just cannot figure it out by myself. I would appreciate your help.
 
Two interaction terms: age (YOUNG/ADULT/OLD) *migraine(Y/N) 
                                    sex (M/F) *migraine
 
Codes:
male=0
female=1
 
young=0
adult=1
old=2
 
CONTRAST STATEMENT:
proc logistic descending;
class migraine(ref='0') age(ref='0') sex(ref='0') race(ref='0') osa(ref='0') income (ref='1')/param=ref;
model htn(event="1")=migraine age sex race osa income migraine*age migraine*sex/risklimits;

contrast 'migraine vs no migraine in young'            migraine 1 0 migraine*age 0 0  /estimate=both;
contrast 'migraine vs no migraine in menopause'   migraine 1 0 migraine*age 1 0  /estimate=both;
contrast 'migraine vs no migraine in old'                 migraine 1 0 migraine*age 0 0  /estimate=both;


contrast 'migraine vs no migraine in female'            migraine 1 0 migraine*sex 1 0  /estimate=both;
contrast 'migraine vs no migraine in male'               migraine 1 0 migraine*sex 0 0 /estimate=both;
run;
 
PROC SORT STATEMENT:
 
proc logistic descending;
class migraine(ref='0') sex (ref='0') race(ref='0') osa(ref='0') income (ref='1')/param=ref;
model htn=migraine age sex race osa income/risklimits;
by age;
run;
 
proc logistic descending;
class migraine(ref='0') age(ref'0') race(ref='0') osa(ref='0') income (ref='1')/param=ref;
model htn=migraine age sex race osa income/risklimits;
by sex;
run;  
 
 
In my contrast statement code, I am able to put the 2 interaction terms together, but I am not able to do the same with proc sort. 
 
I appreciate your advice.

 

Please, if you know how to solve it, contact me: simone_derzi@hotmail.com

 
PaigeMiller
Diamond | Level 26

@mone wrote:

Hello,

 

I have this code, but I do not know what to do where I have question marks. Can anyone give me a hand? t

 

proc logistic data=cchs1516study;
class migraine(ref='0') age(ref='0') sex(ref='0') race(ref='0') osa(ref='0') income (ref='1')/param=ref;
model htn=migraine age sex race osa income age*migraine sex*migraine/risklimits;
contrast 'migraine vs no migraine in young people'            age ???? age*migraine ??? /estimate=both;
contrast 'migraine vs no migraine in menopause people'   age ???? age*migraine ??? /estimate=both;
contrast 'migraine vs no migraine in old people'                 age ???? age*migraine ??? /estimate=both;

contrast 'female vs male in 20-40 group'                            age ???? sex*migraine ??? /estimate=both;
contrast 'female vs male in 40-60 group'                            age ???? sex*migraine ??? /estimate=both;
contrast 'female vs male in >60 group'                               age ???? sex*migraine ??? /estimate=both;
run;

 

 

I really appreciate it.

 

Simone


In my opinion, the whole idea of using a CONTRAST statement is for cases where you are making some unusual linear combination of results, such as -1.3 * level 1 + 3.4 * level2 ... etc., where the coefficients are not +1 or –1 or zero. It is not for the case where you are directly comparing one group to another, all the coefficients are +1 or -1 or zero.

 

In the case where there are two coefficients that are +1 or -1 and the rest are zero, you can use the LSMEANS command or the SLICE command to obtain the results, and then you don't have the difficulty of figuring out what the proper CONTRAST statement is, because SAS has already done this for you. See the first example at: https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_introcom_sect064.htm&docsetVersio...

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 9 replies
  • 982 views
  • 1 like
  • 6 in conversation