Hello,
I am having some issues with the if-then statement. I am trying to make white and black into a new variable called white_black so that I can compare the two using just one variable. Both the white and black variables are coded as 1 if a person is that race and 0 if they are not. There are a total of 320 white individuals and 76 black individuals. When I place the variables into the if-then statement, it seems that there are 2 fewer people included in either group. For example, there may be 320 for white and 74 for black. I am not sure why this is happening. My code is provided below.
if white = 1 then black_white = 1
if black = 1 then black_white = 0
Your "problem" is caused by 7 people who consider themselves neither af_amer nor white, and 2 who think they are af_amer and white.
So instead of 401, your if/then will add up to 396.
Correction: you'll have 7 missing, 320 "white", and 74 "black", because with the double identification white overrides black.
PS your question is a nice illustration of Maxim 3 and the usefulness of proc freq.
Hi @bnd
Thank you for the output.
It seems that 2 people have white=1 and Af_amer=1 -> maybe you should clean these data first.
Your "problem" is caused by 7 people who consider themselves neither af_amer nor white, and 2 who think they are af_amer and white.
So instead of 401, your if/then will add up to 396.
Correction: you'll have 7 missing, 320 "white", and 74 "black", because with the double identification white overrides black.
PS your question is a nice illustration of Maxim 3 and the usefulness of proc freq.
Thanks! @Kurt_Bremser @ed_sas_member
I kept trying to figure out what was going on exactly. After running the frequency table and reading over both of your comments, everything made perfect sense.
Thanks so much for your help!
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!
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.