BookmarkSubscribeRSS Feed
Tz
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?

Thanks

8 REPLIES 8
RW9
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. 

Tz
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;

run;

thanks


RW9
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.

ballardw
Super User

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

Jay54
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?

Community_Help
SAS Employee

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

jakarman
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 --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 8 replies
  • 2364 views
  • 0 likes
  • 6 in conversation