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 !
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.
Thanks for that idea Reiza !! i ll do that .
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...
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;
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.
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.
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.
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:
Hope that this helps!
- James
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!
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.