BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
karlbang
Obsidian | Level 7

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
FreelanceReinh
Jade | Level 19

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.

View solution in original post

3 REPLIES 3
ballardw
Super User

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 ? 


 

FreelanceReinh
Jade | Level 19

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.

karlbang
Obsidian | Level 7
Thank you very much

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 236 views
  • 6 likes
  • 3 in conversation