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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.