BookmarkSubscribeRSS Feed
Obsidian | Level 7 Tz
Obsidian | Level 7

Hi all.

I am trying to use Sgplot to create a histogram on the log scale.

My variable is positive.

Syntax and sample file attached.

I get an error message that the scale includes zeoro or negative values.

What am I doing wrong?


Diamond | Level 26 RW9
Diamond | Level 26

Cant see your code, the queue seems to be blocked.  Anyways, you are sure the data you are using has no number of 0 or less?  If you have a zero, then maybe consider adding 0.0001 to it so it looks on the output like 0, however behind the scenes its really just over. 

Obsidian | Level 7 Tz
Obsidian | Level 7

The variable is positive - no zeros.

This is the code:

prog sgplot;

       histogram dmp / scale=count;

       xaxis type=log base=10 logstyle=linear;



Diamond | Level 26 RW9
Diamond | Level 26

Couldn't see anything directly wrong with that, maybe try changing base to be 2 or E though I don't think it would have any effect, I would still say its in the data though I can't see as the Queue has broken here so files are not available.

Super User

Please show output of the variable from Proc Means or similar showing at least the min value.

Meteorite | Level 14

Since your data and program zip files are still under scan, it is hard to figure out what may be going on.  Can you provide a simple case to illustrate the problem using one of the SASHELP data sets like Cars or Heart, along with the full program?

SAS Employee

I'm checking on the virus scan with our IT department - thank you for your patience

Barite | Level 11

The problem is there are automatic created intervals with a count of zero.  A value of zero cannot be positioned logaritmic.
There must be an other way of scaling 0-1-10-100-1000  (that is 10log like based) a try for that with the binning. Do not see how to influence the binning on that.

---->-- ja karman --<-----



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 6 in conversation