BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
IROCMath
Calcite | Level 5

Hi,

I'm new to SAS and am going through the basic programming modules. I have a data set and want to show a difference in the mean heights of men and women for only a specific age (age=20). I know the concept behind the model I need to use which is logistic. I'm not too familiar with SAS to be able produce what I know I need to do. My dataset contains many, many variables and observations, but I filtered the data to only run analysis for age=20. I am working with GENDER (1=male, 2=female), LENGTH (which is height), and AGE (only needing to look at 20).

 

The response is LENTH vs the GENDER of the individuals for a specific AGE. Any suggestions for commands that may help here...

 

I cooked up this on SAS (University Edition):

 

proc glm data=hw2.z_final;
	class gender;
	where age=24;
	model length=gender/ effectsize alpha=0.05 Solution;
	run;

Thanks in advanced. If I need to clarify, let me know. 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@Reeza wrote:

Continuous outcome  => GLM, ANOVA, T-TEST

Categorical or Binary outcome => LOGISTIC

 

https://www.tutorialspoint.com/sas/sas_ttests

 

GLM treatment of binary variables can be non-intuitive (check the design matrix in your output) so I recommend PROC ANOVA or TTEST instead. 

My usual warning:

 

Although PROC ANOVA will work here in this specific example, it should not be used for most problems of this type. So sayeth the documentation

Use PROC ANOVA for the analysis of balanced data only, with the following exceptions: one-way analysis of variance, Latin square designs, certain partially balanced incomplete block designs, completely nested (hierarchical) designs, and designs with cell frequencies that are proportional to each other and are also proportional to the background population. These exceptions have designs in which the factors are all orthogonal to each other.

--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

This is not  a Logistic Regression, it is probably a t-test, which can be performed in either PROC TTEST or PROC GLM (they should give the same answers).

 

Other than that, it seems like you have done the right thing.

--
Paige Miller
IROCMath
Calcite | Level 5

hmmm... why did my prof say it was log reg...? Ok, thanks!

PaigeMiller
Diamond | Level 26

@IROCMath wrote:

hmmm... why did my prof say it was log reg...?


You could ask your prof to explain.

--
Paige Miller
Reeza
Super User

Are you sure you're interpreting the problem correctly?

 


@IROCMath wrote:

hmmm... why did my prof say it was log reg...? Ok, thanks!


 

Reeza
Super User

Continuous outcome  => GLM, ANOVA, T-TEST

Categorical or Binary outcome => LOGISTIC

 

https://www.tutorialspoint.com/sas/sas_ttests

 

GLM treatment of binary variables can be non-intuitive (check the design matrix in your output) so I recommend PROC ANOVA or TTEST instead. 

 

proc anova data=sashelp.cars;
where make in ("Acura", "BMW");
class make;
model mpg_city = make;
run;

@IROCMath wrote:

Hi,

I'm new to SAS and am going through the basic programming modules. I have a data set and want to show a difference in the mean heights of men and women for only a specific age (age=20). I know the concept behind the model I need to use which is logistic. I'm not too familiar with SAS to be able produce what I know I need to do. My dataset contains many, many variables and observations, but I filtered the data to only run analysis for age=20. I am working with GENDER (1=male, 2=female), LENGTH (which is height), and AGE (only needing to look at 20).

 

The response is LENTH vs the GENDER of the individuals for a specific AGE. Any suggestions for commands that may help here...

 

I cooked up this on SAS (University Edition):

 

proc glm data=hw2.z_final;
	class gender;
	where age=24;
	model length=gender/ effectsize alpha=0.05 Solution;
	run;

Thanks in advanced. If I need to clarify, let me know. 


 

PaigeMiller
Diamond | Level 26

@Reeza wrote:

Continuous outcome  => GLM, ANOVA, T-TEST

Categorical or Binary outcome => LOGISTIC

 

https://www.tutorialspoint.com/sas/sas_ttests

 

GLM treatment of binary variables can be non-intuitive (check the design matrix in your output) so I recommend PROC ANOVA or TTEST instead. 

My usual warning:

 

Although PROC ANOVA will work here in this specific example, it should not be used for most problems of this type. So sayeth the documentation

Use PROC ANOVA for the analysis of balanced data only, with the following exceptions: one-way analysis of variance, Latin square designs, certain partially balanced incomplete block designs, completely nested (hierarchical) designs, and designs with cell frequencies that are proportional to each other and are also proportional to the background population. These exceptions have designs in which the factors are all orthogonal to each other.

--
Paige Miller

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

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
  • 6 replies
  • 1433 views
  • 6 likes
  • 3 in conversation