Hi!
From my research I think proc freq or proc tabulate may be used to create a table that I would like to make:
I have three variables, Ethnicity (Hispanic, non-hispanic), Race (White, AA, Asian, Pacific Islander, ...) and Gender (Male, Female, Unspecified)
I would like to make a table that looks like the following:
Racial Categories Ethnicity
Hispanic Nonhispanic Not Reported TOTAL
Female Male not-reported Female Male not-reported Female Male not-reported
White
African American
Asian FREQUENCY COUNTS
Pacific Islander
etc
What would be the best way to create a table like this in SAS? I am fairly new to SAS, so a thorough explanation would be greatly appreciated.I believe I have SAS version 9.4
.
@awardell wrote:
Thanks for your speedy response. I have put this in SAS, and this gives me the gender by ethnicity table. I'm guessing I will need to do something similar to this to get the tables with all three variables:
proc tabulate data=gender_p;
class race ethnicity gender;
table race, ethnicity*gender
run;
Thanks so much!!!
It depends on how you want to look at things.
One thing it may be helpful to know is that Proc Tabulate supports multiple table statements.
Second is the , separates dimensions (page, row and column) and * nests variables and statistics within a dimension:
so you might look at
proc tabulate data=gender_p; class race ethnicity gender; table race, ethnicity*gender ; table race, ethnicity, gender ; table race * ethnicity, gender ; table race * ethnicity * gender ; table race ethnicity gender, race ethnicity gender ; run;
for a variety. The N statistic is assumed for class variables is no other is requested. There are a number of percentages that could be requested as well.
Thanks for your speedy response. I have put this in SAS, and this gives me the gender by ethnicity table. I'm guessing I will need to do something similar to this to get the tables with all three variables:
proc tabulate data=gender_p;
class race ethnicity gender;
table race, ethnicity*gender
run;
Thanks so much!!!
@awardell wrote:
Thanks for your speedy response. I have put this in SAS, and this gives me the gender by ethnicity table. I'm guessing I will need to do something similar to this to get the tables with all three variables:
proc tabulate data=gender_p;
class race ethnicity gender;
table race, ethnicity*gender
run;
Thanks so much!!!
It depends on how you want to look at things.
One thing it may be helpful to know is that Proc Tabulate supports multiple table statements.
Second is the , separates dimensions (page, row and column) and * nests variables and statistics within a dimension:
so you might look at
proc tabulate data=gender_p; class race ethnicity gender; table race, ethnicity*gender ; table race, ethnicity, gender ; table race * ethnicity, gender ; table race * ethnicity * gender ; table race ethnicity gender, race ethnicity gender ; run;
for a variety. The N statistic is assumed for class variables is no other is requested. There are a number of percentages that could be requested as well.
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!
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.