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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 404 views
  • 0 likes
  • 4 in conversation