BookmarkSubscribeRSS Feed
Srigyan
Quartz | Level 8

I am running following code.

 

ods graphics on;
proc freq data=sashelp.heart order=freq ;
   tables smoking_status*weight_status / plots=mosaic(square ) ;
run;

ods graphics off;

I am getting mosaic plot but i dont get a data label i.e.what % heavy has and what % is non-smoker has, is there any option i can add data label.

 

 
1 REPLY 1
koyelghosh
Lapis Lazuli | Level 10

@Srigyan Data labels on the top of graph is going to be tricky (as the rectangles become smaller and smaller). Instead you can use an option so that when you hover over the rectangle it shows all the info. Just use the code below, hover and wait for 1 second.

 

ods graphics on / imagemap;
proc freq data=sashelp.heart order=freq ;
   tables smoking_status*weight_status / plots=mosaic(square ) ;
run;

ods graphics off;

The key is "imagemap" option in ods graphics.

If rather you are looking for percent info in the table then read the second row in every block.

Let me know if this helped in any way.

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 16. 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
  • 1 reply
  • 701 views
  • 1 like
  • 2 in conversation