BookmarkSubscribeRSS Feed
scmax
Calcite | Level 5

I'm using Proc Boxplot and Plot syntax to draw a bar chart that contains error bars. For some reason, I need to label the mean of each box with maximum of 2 digits in decimal place.

So I used:

Plot Variable1 * Variable2 /

       ALLLABEL = value

However, the output box in the diagram about the mean contains 3 digit decimal places (ex.: 3.123). How can I reduce the number of decimal digit to 2 or 1 (ex.: 3.1)?

Thanks a lot in advanced.

M

4 REPLIES 4
ballardw
Super User

Have you tried having a Format Value f4.2; statement?

scmax
Calcite | Level 5

Hi

Thanks for your reply. I did try the statement

Informat variable1 variable2 4.2;

format value f4.2;

and I put these statements after Boxplot statement and after the PLOT statement.

As I placed it after Boxplot statement, the log shows that there is no variable named VALUE. As I placed the format value f4.2 after the PLOT statement, the program couldn't run due to the invalid statement, in that it is not allow to use Format directly after PLOT;

Is there other approaches to format the label and its decimals under BOXPLOT or PLOT?

Thanks.

Max

ballardw
Super User

I think you might want to post your entire proc code.

scmax
Calcite | Level 5

Hi Ballardw

Thanks for the prompt reply. Here ares the codes I used.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ODS GRAPHICS off;

ODS HTML CLOSE; 

/*Output the graphs using BOXPLOT*/

ODS LISTING;

symbol value=DIAMONDFILLED color=black;

Title1 'xxx';

Proc BOXPLOT DATA= dt1;

Informat PEAK MIN MEAN PER10 PER50 PER90 4.1;

Format

       Device Device.;

       where ID > 1 & ID ^= 2   /* & ID ^= 13*/  ;

       Format Value f4.2;

       Plot PEAK*Device /

       /* vformat = percent8.2 */

       ALLLABEL = value 

       /* vref= 46.36 cvref=red  */

      Boxstyle = skeletal

      Boxwidth=7

      CBOXFILL = GRAYFF;

      label PEAK = ' Peak Speed (Degree/Second)'; 

      Label Device = 'Devices';

Run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 2013 views
  • 0 likes
  • 2 in conversation