how to prevent midpoints from extending

2019-07-25 00:29发布

问题:

I have the following code

proc univariate data=work.dataset noprint;
    histogram value / barwidth=.05 midpoints=(-2.45 to 2.45 by .05) outhist=data_bin nochart;

run; I get this warning message in the log WARNING: The MIDPOINTS= list was extended to accommodate the data.

I basically want to prevent the midpoints from extending I want them to start from -2.5 and end at 2.5.

SOLVED

Just need to bin the data before the proc step

回答1:

SOLVED

Basically at data creation point I cap the values of variable value in between the range of -2.5 and 2.5.

The code still remains the same just added a if statement in data to cull the data from -2.5 to 2.5



回答2:

Use the maxnbin option to set the maximum number of bins you have. For example, endpoints = 0 to 2 by .2 maxnbin=10. This way you can keep your data as is.



标签: sas