Obsidian | Level 7

## barwidth has no effect when using HIGHLOW in PROC SGPLOT

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: barwidth has no effect when using HIGHLOW in PROC SGPLOT

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.

3 REPLIES 3
Super User

## Re: barwidth has no effect when using HIGHLOW in PROC SGPLOT

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 ?

## Re: barwidth has no effect when using HIGHLOW in PROC SGPLOT

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.

Obsidian | Level 7

## Re: barwidth has no effect when using HIGHLOW in PROC SGPLOT

Thank you very much
Discussion stats
• 3 replies
• 385 views
• 6 likes
• 3 in conversation