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:
You have 11 bins, not 10.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: