Hey all,
is there any (easy) possibility to program the box and bin layout of a histogram in proc univariate?
I am using SAS university, I am not allowed to use proc sgplot, it has to be proc univariate and I am desperate, because nothing is working.
Thank you!
@Lacona wrote:
Sure!
dataset ist SAShelp.gasproc univariate data=gas noprint; histogram/odstitle="5 histograms of nitrogen oxide" normal barlabel=percent vaxislabel='percent' nrows=5 inheight=2.0 cfill=pink grid; attrib _all_ label=''; title font=arial justify=center underlin=1 color=BIPPK height=4 "Histogram of Nitrogen Oxide"; class fuel; var nox; inset n="N:"(5.3) mean="Mean:"(5.3) / pos=ne font=arial ctext=BIB cframe=slategray height=1.8; run;
Instruction from the teacher was, that we have to use proc univariate. He can do the layout by goption, but that is not possible in SAS university.
I would like to change the appearance of the box (height, width, color) and also of the inset and the bins.
Pattern color=blue value=solid didn't work either.
ODS GRAPHICS options can set height and width of graph objects. If you mean "boxes" inside the graph then you may be looking at options in the histogram statement like MIDPOINTS=(middle of histogram column list values) , NENDPOINTS or NMIDPOINTS (number of end or center points).
Colors are controlled by the current ODS style by default. Most of the color options available in Proc Univariate Histograms I am familiar with only apply to the traditional (i.e. SAS/Graph) graphics.
Show the code you have attempted so far.
And why can you not use SGPLOT? Is that an instruction from a teacher?
Sure!
dataset ist SAShelp.gas
proc univariate data=gas noprint;
histogram/odstitle="5 histograms of nitrogen oxide" normal barlabel=percent
vaxislabel='percent' nrows=5 inheight=2.0 cfill=pink grid;
attrib _all_ label='';
title font=arial justify=center underlin=1 color=BIPPK height=4 "Histogram of Nitrogen Oxide";
class fuel;
var nox;
inset n="N:"(5.3) mean="Mean:"(5.3) / pos=ne font=arial ctext=BIB cframe=slategray height=1.8;
run;
Instruction from the teacher was, that we have to use proc univariate. He can do the layout by goption, but that is not possible in SAS university.
I would like to change the appearance of the box (height, width, color) and also of the inset and the bins.
Pattern color=blue value=solid didn't work either.
Very helpful to know, that I don't have to search around for other solutions any more.
Why wouldn't you recommend to play around with the templates?
At first glance, playing around with templates doesn't seem too complicated, but maybe I am overseeing something?
Thank you for the explanation.
I will keep it in mind.
@Lacona wrote:
Sure!
dataset ist SAShelp.gasproc univariate data=gas noprint; histogram/odstitle="5 histograms of nitrogen oxide" normal barlabel=percent vaxislabel='percent' nrows=5 inheight=2.0 cfill=pink grid; attrib _all_ label=''; title font=arial justify=center underlin=1 color=BIPPK height=4 "Histogram of Nitrogen Oxide"; class fuel; var nox; inset n="N:"(5.3) mean="Mean:"(5.3) / pos=ne font=arial ctext=BIB cframe=slategray height=1.8; run;
Instruction from the teacher was, that we have to use proc univariate. He can do the layout by goption, but that is not possible in SAS university.
I would like to change the appearance of the box (height, width, color) and also of the inset and the bins.
Pattern color=blue value=solid didn't work either.
ODS GRAPHICS options can set height and width of graph objects. If you mean "boxes" inside the graph then you may be looking at options in the histogram statement like MIDPOINTS=(middle of histogram column list values) , NENDPOINTS or NMIDPOINTS (number of end or center points).
Colors are controlled by the current ODS style by default. Most of the color options available in Proc Univariate Histograms I am familiar with only apply to the traditional (i.e. SAS/Graph) graphics.
ods graphics on/width=4 height=6; worked perfectly! Thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.