BookmarkSubscribeRSS Feed
jyothisri
Fluorite | Level 6

Hi all, I have run the program stated below and i am getting a box plot with only few observations being used in the x axis. I am unsure if i clear enough.

PROC SGPLOT DATA = HypAnl.HypAnalysis1;
VBOX DBP / CATEGORY = EthRaceCd;
LABEL DBP = 'Latest DBP Measurement';
LABEL EthRaceCd = 'Ethnicity/RaceGroup';
TITLE 'Diastolic blood pressures by ethnicity/RaceGroup';
RUN;

 

So, when i run the above program, i am getting just a single box. I am unsure if it is correct. I am also attaching the results below. Any help is appreciated ! Thank you !

 

10 REPLIES 10
PaigeMiller
Diamond | Level 26

Many people will not download attachments. You can include in your reply a screen capture of the output you want to show us by clicking on the camera icon.

 

We also would need to see a portion of your data (provided via these instructions)

 

I'm guessing that you have only one level of EthRaceCd, that's why you only get one box. But that's a guess. You should check that.

--
Paige Miller
jyothisri
Fluorite | Level 6
Thanks for the reply paige. I shall do as advised by you.
Reeza
Super User
Post your log, and check it against a known data set, like sashelp.heart first.
jyothisri
Fluorite | Level 6

Thanks for that idea Reiza !! i ll do that .

Cooksam13
Fluorite | Level 6

I suggest being specific with YAXIS LABEL = ..... and XAXIS LABEL = ......

However when I tested your data it came up as separate boxes so it might have somethin to do with your data...

ssills24
Calcite | Level 5

Hi jyothisri, 

 

I recommend trying this code: 

 

PROC SGPLOT DATA = HypAnl.HypAnalysis1;
VBOX DBP / CATEGORY = EthRaceCd;


XAXIS LABEL = 'Ethnicity/Race Group'

YAXIS VALUES = (0 TO 100 BY 10)
LABEL = 'Latest DBP Measurement';
 
RUN;

 

Reeza
Super User
I believe OPs data goes beyond the 100 range, given a previous post where they wanted a reference line over 100.
jyothisri
Fluorite | Level 6

Hi ssils24,

Thanks a lot for the reply. 

I tried but it still shows the same. does this have something to do with the data ? I am unsure. Some of them advised not to attach a post but t share a screenshot . I tried but it didnt work out. I am attaching the data file below. Please advise.

yeji6144
Calcite | Level 5

Hi! I came from the class Canvas discussion page, I'm in your class so I tried out your dataset with my code as well as your code with your dataset and it worked fine for me. This is what I get from running your code with your dataset. 

yeji6144_1-1607207553106.png

Maybe try re-running your dataset before you run your code? Also make sure your LIBNAME statements are correct and that it's referring to the right file.

JamesPatton01
Calcite | Level 5

Hello jyothisri! 

 

In order to solve this issue you need to include an XAXIS statement that designates the different categories and values for EthRaceCd. First, make sure to include the the keyword "CATEGORY" instead of "GROUP" in the PROC statement since EthRaceCd is character rather than numeric. In addition, in the XAXIS statement make sure to include both the VALUES and the DISPLAYVALUES statement. The VALUES statement should tell SAS to display the values that you want along the x-axis and the DISPLAYVALUES statement will tell SAS how you want those axis labels to appear in the final result. I have included some example code for you to look at below: 

 

PROC SGPLOT DATA = HypAnl.HypAnalysis1 NOAUTOLEGEND;
VBOXDBP / CATEGORY = EthRaceCd;

 

XAXISVALUES= ( 'HIS' 'NHA' 'NHB' 'NHO' 'NHW' )
VALUESDISPLAY = ('Hispanic' 'NH Asian' 'NH Black' 'NH Other Race' 'NH White')
OFFSETMIN= 0.2
OFFSETMAX = 0.2
LABEL= 'Ethnicity/Race Group'
LABELATTRS= (WEIGHT= BOLD);

 

Hope that this helps! 

- James 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 10 replies
  • 1604 views
  • 4 likes
  • 7 in conversation