BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Fara_I
Fluorite | Level 6

I have the following code, and when I run it, it gives me the following output graph, but I want to adjust my histogram so that the x-axis shows the values of sum_dices from {2, 3, 4, …, 12} and the y-axis is the corresponding percent for each sum_dice (i.e {2.78, 5.56, 8.33, …, 2.78} ). I tried to do this by setting the binwidth to 1 but it did not really change anything to my understanding. I am new to SAS so I will appreciate any help you can provide me. Thank you! 

CODE: 

data auto;
do dice1= 1 to 6;
do dice2= 1 to 6;
sum_dices = sum(dice1, dice2);
output;
end;
end;
proc freq data = auto;
proc sgplot data = auto;
histogram sum_dices/ nbins = 10 binwidth = 1 showbins scale= count datalabel=percent;
run;

 

OUTPUT: 

2.jpg

3.png

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You have 11 bins, not 10.

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

You have 11 bins, not 10.

--
Paige Miller

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
  • 1 reply
  • 823 views
  • 0 likes
  • 2 in conversation