BookmarkSubscribeRSS Feed
SAS93
Quartz | Level 8

I'm new to using proc SQL, but I'm using it to look at counts of states by race/ethnicity (separate categories). 

 

I want to include a new group called "all" for both race and ethnicity, so it would be combining (for each of race and ethnicity) the total counts for the 2 categories. 

 

What is the easiest way to do this? To create this table, I'm using two separate tables that already have race and ethnicity broken down; would it be easier to modify those primary tables, or somehow create a new variable within the new table? 

3 REPLIES 3
Reeza
Super User
Not using SQL is faster - PROC MEANS does this by default or PROC TABULATE.
For MEANS look into the CLASS, WAYS and TYPES statements.

PaigeMiller
Diamond | Level 26

I'm using two separate tables that already have race and ethnicity broken down


Can you show us a portion of these two tables? Can you show us the desired output?

--
Paige Miller
PGStats
Opal | Level 21

@SAS93 wrote:

What is the easiest way to do this?


If you want a dataset, use proc Means. If you want a report table, use proc Tabulate.

PG
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
  • 3 replies
  • 1205 views
  • 0 likes
  • 4 in conversation