Help using Base SAS procedures

Proc Boxplot and decimal in labels

Reply
New Contributor
Posts: 3

Proc Boxplot and decimal in labels

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

Super User
Posts: 11,343

Re: Proc Boxplot and decimal in labels

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

New Contributor
Posts: 3

Re: Proc Boxplot and decimal in labels

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

Super User
Posts: 11,343

Re: Proc Boxplot and decimal in labels

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

New Contributor
Posts: 3

Re: Proc Boxplot and decimal in labels

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;

Ask a Question
Discussion stats
  • 4 replies
  • 396 views
  • 0 likes
  • 2 in conversation