Having trouble setting x-axis endpoints in proc univariate

23 Views Asked by At

My code is as follows:

data mydata;
    call streaminit(1234);
    do binary = 0 to 1;
        do i = 1 to 1000;
            var = rand('integer', 0, 150);
            output;
        end;
    end;
run;

proc univariate data=mydata noprint;
where var le 100;
class binary;
histogram var/overlay endpoints=0 to 100;
run;

Unfortunately, it doesn't work for me exactly as I would like it to. It shows 110 on the x-axis and the bar for 100 is to right of it. Is there a way to format the x-axis so that it doesn't show 110 on the x-axis?

I tried changing my code with different restrictions to see if that works. It works when I restrict my data to 80 or 90. X-axis does cutoff at 80 or 90 respectively. It is the 100 that seems to extend the x-axis.

Edit:

proc sgplot data=mydata;
histogram var/group=binary;
xaxis values=(0 to 100 by 10);
run;

Edit2: Richard's suggestion to use midpoints, instead of endpoints, in proc univariate worked too. Thank you Sir!

0

There are 0 best solutions below