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

I need to get the mean score for an implicit bias test from each group within the demographic categories I am using (i.e Age, Gender, Race) and get the p-value per my committee chair. He is not used to SAS so is unable to assist me, but he advised me to search if I can get a t-test and ANOVA using proc means for categories that have two groups and ones that have more than two groups respectively.

I found out how to run a paired t test using proc means (please let me know if I did this incorrectly):

Age.PNG

proc means data=IAT2018 N MEAN T PRT;
class birthsex;
var D_biep_White_Good_all;
run; 

 

Is there a possible way to run an ANOVA test using PROC MEANS as well?  My committee chair really wants me to do this, but I am at a loss. Also, I am unable to upload the data since it is 1.3 GB so I apologize for any inconvenience. Please let me know if you require further information. 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@tainaj wrote:

An example of what I actually want to test for is to see if there is a difference in mean IAT score between each race. The null hypothesis: there is no difference in mean IAT score between each race. Alternative hypothesis: at least one of the races has a different mean IAT score. I would like to do this for each demographic category (Gender, race, education level, political affiliation, occupation). Please let me know if I need to add further information or need to clarify something? Also, please let me know if there is anything wrong with what I am trying to test.

This can be done in PROC ANOVA or PROC GLM. Example: https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_anova_gettingstarted01.htm

--
Paige Miller

View solution in original post

11 REPLIES 11
Reeza
Super User

PROC MEANS cannot run a t-test, what it's doing there is checking if the mean is 0, not testing if they're equivalent between the classes. That's why you have two test statistics (t-value) that differ instead of a single value for the test. 

 

PROC MEANS cannot do the ANOVA/TTEST but PROC ANOVA/TTEST can, is there a reason you can't use them?

 

Here's an older proc anova tutorial but the free SAS Stats course will cover these topics as well.  

https://www.stattutorials.com/SAS/TUTORIAL-PROC-GLM.htm

 


@tainaj wrote:

I need to get the mean score for an implicit bias test from each group within the demographic categories I am using (i.e Age, Gender, Race) and get the p-value per my committee chair. He is not used to SAS so is unable to assist me, but he advised me to search if I can get a t-test and ANOVA using proc means for categories that have two groups and ones that have more than two groups respectively.

I found out how to run a paired t test using proc means (please let me know if I did this incorrectly):

Age.PNG

proc means data=IAT2018 N MEAN T PRT;
class birthsex;
var D_biep_White_Good_all;
run; 

 

Is there a possible way to run an ANOVA test using PROC MEANS as well?  My committee chair really wants me to do this, but I am at a loss. Also, I am unable to upload the data since it is 1.3 GB so I apologize for any inconvenience. Please let me know if you require further information. 


 

tainaj
Obsidian | Level 7

This is what I wanted to run initially, but my committee chair stated that I need to run a test between each group in each category. For example, get the p-value for the mean IAT score and the different age groups (16-19, 20-29, 30-39, 40-49, 50-64, and 65+). For context, I used proc means in order to get the mean IAT scores in the table below; the data does IAT score does not show up as mean values of course. Unfortunately, he is asking me to do this but is unable to show me any sort of example of how to achieve what he is asking for since he uses a different software.  

 

Screen Shot 2022-03-03 at 16.41.40.png

tainaj
Obsidian | Level 7
Since you are saying this is impossible, do you think simply running PROC ANOVA and PROC TTEST would provide the result as you stated? Also, please let me know if you require information or more details on what my committee chair is asking me to do!
Reeza
Super User

@tainaj wrote:
Since you are saying this is impossible, do you think simply running PROC ANOVA and PROC TTEST would provide the result as you stated? Also, please let me know if you require information or more details on what my committee chair is asking me to do!

This is impossible to do with PROC MEANS.

 

Yes, running ANOVA/TTEST will provide the results you want. Did you read through the tutorials I linked to?

Reeza
Super User
FYI - this is a very common analysis, called Table1 which is included in most journal publications especially medical journals. If you're going into this field it's worth understanding this process.
PaigeMiller
Diamond | Level 26

For example, get the p-value for the mean IAT score

 

P-values don't exist as an independent entity. P-values only exist for testing a specific hypothesis, which you haven't been clear about. What hypothesis do you want p-values for? Please be specific.

 

Agreeing with @Reeza , PROC GLM or PROC TTEST or similar is the way to go here. PROC MEANS is a waste of time, as explained above that PROC MEANS only tests the hypothesis that the mean is equal to zero.

 

By the way, the table you present does not do any hypothesis testing, and so is relatively meaningless in the context of your question.

--
Paige Miller
tainaj
Obsidian | Level 7
Thank you for your response. I did not provide the table as a means of showing a hypothesis test; I provided it to give a little more context if possible about what my committee chair wanted me to do using proc means, which frankly I was confused by so it's reassuring to see that it didn't much sense to you as well.

An example of what I actually want to test for is to see if there is a difference in mean IAT score between each race. The null hypothesis: there is no difference in mean IAT score between each race. Alternative hypothesis: at least one of the races has a different mean IAT score. I would like to do this for each demographic category (Gender, race, education level, political affiliation, occupation). Please let me know if I need to add further information or need to clarify something? Also, please let me know if there is anything wrong with what I am trying to test.
Reeza
Super User
Here's a way to do this all in one step. You will need to read the paper and tutorial and then follow it for your own data.

https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-...
tainaj
Obsidian | Level 7
Thank you for providing this! I have never used macros before as I have never earned this, but I tried following the detailed instructions and using google for a couple things. Where in my sas code should I place it? I received this error below. Also, I am unsure if you could help me with this, but I saw in my google search that some people use an .xlsx file for outdoc so I created a file and included the filepath and name in the outdoc statement. I am unsure if this was the right thing to do.
328 %tablen(data=IAT2018, by=D_biep_White_Good_all,
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
329 var=Age raceomb_002 birthSex edu politicalid_7 occupation_selfdetail_001,
330 type=1 2, pvals=5,
331 contdisplay=m sd, outdoc=\Users\tjoseph6\Documents\IAT2018.xlsx);
332 run;
PaigeMiller
Diamond | Level 26

@tainaj wrote:

An example of what I actually want to test for is to see if there is a difference in mean IAT score between each race. The null hypothesis: there is no difference in mean IAT score between each race. Alternative hypothesis: at least one of the races has a different mean IAT score. I would like to do this for each demographic category (Gender, race, education level, political affiliation, occupation). Please let me know if I need to add further information or need to clarify something? Also, please let me know if there is anything wrong with what I am trying to test.

This can be done in PROC ANOVA or PROC GLM. Example: https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_anova_gettingstarted01.htm

--
Paige Miller

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 2627 views
  • 3 likes
  • 3 in conversation