BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gx2144
Calcite | Level 5
title "Gender Distribution of Company A";
proc sgplot data = baseline;
vbar Sex__Male_1_ /response=percent  datalabel ;
format Sex__Male_1_ sex.;
run;

response = percent not working the log shows:

35  ods trace on;
136  title "Gender Distribution of Company A";
137  proc sgplot data = baseline;
138  vbar Sex__Male_1_ /response=percent  datalabel ;
ERROR: Variable PERCENT not found.
139  format Sex__Male_1_ sex.;
140  run;

Need help to transform the yaxis into percent format

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

RESPONSE= requires a variable in the data set.

STAT=percent specifies the statistic used for the Yaxis

 

So perhaps you are looking for something like:

proc sgplot data=sashelp.class;
   vbar age / stat=percent;
run;

where each bar at the Age value represents the percentage of the number of records?

View solution in original post

1 REPLY 1
ballardw
Super User

RESPONSE= requires a variable in the data set.

STAT=percent specifies the statistic used for the Yaxis

 

So perhaps you are looking for something like:

proc sgplot data=sashelp.class;
   vbar age / stat=percent;
run;

where each bar at the Age value represents the percentage of the number of records?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 887 views
  • 0 likes
  • 2 in conversation