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
Have you tried having a Format Value f4.2; statement?
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
I think you might want to post your entire proc code.
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.