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

Screenshot (118).pngScreenshot (119).png

When I use proc tabulate it is not showing all of the categories under my variable. Here is my code:

 

proc tabulate data=combined ;
class obese;
var racenew;
table racenew,
obese='Obese'*(n=' '*f=comma12.0 pctsum=' '*f=pctfmt.) ;
format racenew racenew. obese obese. ;
run;

 

Here is a picture of what comes out:

                              ObesePatients with Obesity
Patients without
ObesityRace
3,168(7.94%)36,482

(92.06%)

 

 

 

I want it to show the categories of 'Race'. Ex:                                                                                                                                                      Race                                     

Native American

Caucasian          

African American

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jogden
Fluorite | Level 6

I just figured it out!

 

Here is my code:

 

proc tabulate data=combined ;
class obese racenew;
table racenew,
obese='Obese'*(n=' '*f=comma12.0 pctn=' '*f=pctfmt.) ;
format racenew racenew. obese obese. ;
run;

 

 

Screenshot (121).png

View solution in original post

3 REPLIES 3
Astounding
PROC Star

To get the report you have shown, RACENEW must be part of the CLASS statement, not part of the VAR statement.

 

What are you trying to sum here?  Is there some other variable that you haven't mentioned?  Or do you actually need PCTN instead of PCTSUM?

jogden
Fluorite | Level 6

Screenshot (120).png

 

 

 

 

 

 

 

 

 

So basically, I am wanting the Race categories to show. I am not sure how to code that though. I want it to show both 'Obese' and 'Race' categories like the above picture.

jogden
Fluorite | Level 6

I just figured it out!

 

Here is my code:

 

proc tabulate data=combined ;
class obese racenew;
table racenew,
obese='Obese'*(n=' '*f=comma12.0 pctn=' '*f=pctfmt.) ;
format racenew racenew. obese obese. ;
run;

 

 

Screenshot (121).png

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1107 views
  • 0 likes
  • 2 in conversation