Data visualization with SAS programming

Box Plot

Accepted Solution Solved
Reply
Contributor
Posts: 55
Accepted Solution

Box Plot

I am creating a vertical box plot and want to add some specific features. So far I have produced this code that creates the general structure that I want.

 

title "Diastolic Blood Pressure by Ethnicity/Race Group" bold;
proc sgplot data = HypAnl.HypPrimanl;
vbox DBP / group = EthRaceCd ;
run;

 

I now want to add some specific features, but am unsure exactly where in code they actually go. For example, I want a reference line called "Hypertension Threshold" that runs at 90 on the Y-axis. Where in the code do I add these kind of features?


Accepted Solutions
Solution
2 weeks ago
SAS Super FREQ
Posts: 945

Re: Box Plot

Posted in reply to marianhabesland

title "Diastolic Blood Pressure by Ethnicity/Race Group" bold;
proc sgplot data = HypAnl.HypPrimanl;

refline 90;
vbox DBP / group = EthRaceCd ;
run;

 

This will make the reference line draw behind the boxes. Move the REFLINE statement after the VBOX statement if you want them drawn in front of the boxes. There are a number of options on the REFLINE statement to enhance its appearance.

 

Hope this helps!

Dan

View solution in original post


All Replies
SAS Super FREQ
Posts: 373

Re: Box Plot

Posted in reply to marianhabesland

Just add more statements.  In particular, put a REFLINE statement after the PROC statement.

 

http://go.documentation.sas.com/?docsetId=grstatproc&docsetTarget=n0ezn6n9coszztn100iyzhfvwnhp.htm&d...

 

Statements listed first get displayed first.

Solution
2 weeks ago
SAS Super FREQ
Posts: 945

Re: Box Plot

Posted in reply to marianhabesland

title "Diastolic Blood Pressure by Ethnicity/Race Group" bold;
proc sgplot data = HypAnl.HypPrimanl;

refline 90;
vbox DBP / group = EthRaceCd ;
run;

 

This will make the reference line draw behind the boxes. Move the REFLINE statement after the VBOX statement if you want them drawn in front of the boxes. There are a number of options on the REFLINE statement to enhance its appearance.

 

Hope this helps!

Dan

Contributor
Posts: 55

Re: Box Plot

Thank you both! That definitely helps!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 142 views
  • 0 likes
  • 3 in conversation