SAS X轴对数刻度

时间:2019-10-13 14:20:12

标签: logging graph sas histogram scale

我正在使用sgplot创建直方图。

有人知道如何以对数刻度显示x轴吗?

我尝试遵循以下文档,但似乎不起作用。 我收到以下警告:

NOTE: Log axis cannot support zero or negative values in the data range.
      The axis type will be changed to LINEAR.

https://documentation.sas.com/?docsetId=grstatproc&docsetTarget=p07m2vpyq75fgan14m6g5pphnwlr.htm&docsetVersion=9.4&locale=en#n10tv33ymilnhln1ld2l0ny0x11u

data Have;
call streaminit(12345);
do i = 1 to 10000;
   t = abs(rand("normal", 0, 5));
   x = exp(t);
   y = rand("Normal");
   if abs(x)>1 then output;
end;
run;

proc sgplot data=have;
histogram x;
xaxis type=log logbase=10 logstyle=logexpand 
   logvtype=exponent
   min=1 max=8;
run;

1 个答案:

答案 0 :(得分:0)

请考虑做一个对数变换的直方图:

data plot;
  set have;
  log10x = log10(x);
run;

proc sgplot data=plot;
histogram log10x;

* xaxis type=log logbase=10 logstyle=logexpand 
   logvtype=exponent
   min=1 max=8
  ;
run;

enter image description here