BookmarkSubscribeRSS Feed
Obsidian | Level 7

## How do i run a univariate analysis for this?

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

## Re: How do i run a univariate analysis for this?

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

Super User

## Re: How do i run a univariate analysis for this?

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

## Re: How do i run a univariate analysis for this?

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

Super User

## Re: How do i run a univariate analysis for this?

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

Obsidian | Level 7

## Re: How do i run a univariate analysis for this?

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;

Super User

## Re: How do i run a univariate analysis for this?

This isn’t univariate analysis then.
Discussion stats
• 6 replies
• 1570 views
• 0 likes
• 2 in conversation