I am making a HIGHLOW plot
data w;
input x y _ $;
datalines;
-2.460 17 A
-0.977 12 A
0.014 18 A
0.984 18 A
2.429 6 A
-0.33 -1 B
-0.97 -1 B
0.61 -1 B
0.69 -1 B
;
run;
data w;
set w;
if _ = 'A' then do;
high = y;
low = 0;
end;
if _ = 'B' then do;
high = 0;
low = y;
end;
proc sgplot data = w;
highlow x = x low = low high = high / type = bar group = _ barwidth = 0.95;
run;I must be doing something wrong since all values of barwidth gives me the same plot. Any suggestions about what I am doing wrong ?
Hello @karlbang,
If you don't want to change the axis type: For your linear X axis the INTERVALBARWIDTH= option is applicable. Try values like 0.07in, 1.5mm, 4px, 6, etc.
From the HIGHLOW statement option BARWIDTH documentation:
Requirement This option is applicable only when the X or Y axis is discrete.
So you need to add an XAXIS statement setting TYPE=DISCRETE.
@karlbang wrote:
I am making a HIGHLOW plot
data w; input x y _ $; datalines; -2.460 17 A -0.977 12 A 0.014 18 A 0.984 18 A 2.429 6 A -0.33 -1 B -0.97 -1 B 0.61 -1 B 0.69 -1 B ; run; data w; set w; if _ = 'A' then do; high = y; low = 0; end; if _ = 'B' then do; high = 0; low = y; end; proc sgplot data = w; highlow x = x low = low high = high / type = bar group = _ barwidth = 0.95; run;I must be doing something wrong since all values of barwidth gives me the same plot. Any suggestions about what I am doing wrong ?
Hello @karlbang,
If you don't want to change the axis type: For your linear X axis the INTERVALBARWIDTH= option is applicable. Try values like 0.07in, 1.5mm, 4px, 6, etc.
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 lock in 2025 pricing—just $495!
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.