BookmarkSubscribeRSS Feed
Mystik
Obsidian | Level 7

Hello,

so am running a univariate analyses by putting each variable alone in the model.

the outcome is acet;

the dependent variable is sex (coded Men=1 and Women=2)

the independent variables are; csa (coded as 1 or 0) and age (coded which is numeric i.e. 18, 32, 56, 89, etc)

 

For example below; i tried putting only sex in the model but i keep getting error from the SAS log. please any help?

 

proc genmod data=avia88 desc;
class sex;
model acet=csa sex*csa/link=logit dist=binomial type3;
estimate "M:" csa csa*sex 1 -1 0 0/exp;
estimate "W:" oral_cs csa*sex 0 0 -1 1/exp;
run;

6 REPLIES 6
Mystik
Obsidian | Level 7

made a mistake in the first one.

This is it below:

 

proc genmod data=avia88 desc;
class sex;
model acet=sex csa sex*csa/link=logit dist=binomial type3;
estimate "M:" csa csa*sex 1 -1 0 0/exp;
estimate "W:" csa csa*sex 0 0 -1 1/exp;
run

Reeza
Super User
Your model has more than one variable but you're saying you want univariate analysis which would imply that your model statement should have only a single variable in the MODEL statement. You have "sex cya sex*csa" which is your full model.

And remember if you do put only a single variable in the model, the other steps, ESTIMATE statements, need to be adjusted accordingly.

One trick that helps to make sure you're doing this correctly is to comment your code with what what you think each line is doing. Then you can easily modify it as you go.
Mystik
Obsidian | Level 7

Thank you. here is it.

 

proc genmod data=avia88 desc;
class sex;
model acet=sex csa sex*csa/link=logit dist=binomial type3;
estimate "M:" sex csa csa*sex 1 -1 0 0/exp;
estimate "W:"  sex csa csa*sex 0 0 -1 1/exp;
run;

 

the independent variable is sex.

adjusting for csa (1,0), age(18, 23, 89 etc) etc...

but for now i want to do a univariable analyses with each variable one by one in the form of OR 95CI

Reeza
Super User

Univariate means one variable in the model statement. 
You still have multiple variables. 


@Mystik wrote:

Thank you. here is it.

 

proc genmod data=avia88 desc;
class sex;
model acet=sex csa sex*csa/link=logit dist=binomial type3;
estimate "M:" sex csa csa*sex 1 -1 0 0/exp;
estimate "W:"  sex csa csa*sex 0 0 -1 1/exp;
run;

 

the independent variable is sex.

adjusting for csa (1,0), age(18, 23, 89 etc) etc...

but for now i want to do a univariable analyses with each variable one by one in the form of OR 95CI


 

Mystik
Obsidian | Level 7

Yes i agreed univariate is one variable in the model but remember there is sex in there bcos i wanted to stratify by sex (male vs female) to create a table stratified by sex. As i said earlier, the dependent variable is sex and In this case you have to include sex.

 

Eventually, i got it all figured out as the problem was coming from the "estimate" side; e.g. -1 1 and -1 1 0 0 for males.

So the sas code below worked perfectly for me now.

 

proc genmod data=avia88 desc;
class sex csa;
model acet=sex csa sex*csa/link=logit dist=binomial type3;
estimate "M:" csa  -1 1 csa*sex -1 1 0 0/exp;
estimate "W:" csa -1 1 csa*sex 0 0 -1 1/exp;
run;

 

 

Reeza
Super User
This isn’t univariate analysis then.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1934 views
  • 0 likes
  • 2 in conversation