Data visualization with SAS programming

Log scale yaxis

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Log scale yaxis

Hi all,

I am a new SAS user and want to present the data in log scale for y (see data and code below).  But it does not work. Did I miss something? how to show minor tick marks?

Thanks

Muyi

data a;
input x y;
datalines;
0 31
2 69.4
4 78.3
6 82.4
8 51.1
10 34.1
;
run;

proc sgplot data=a;
xaxis label='x' values=(0 to 10 by 2) minor;
yaxis label='y' type=log logbase=10 ; 
series x=x y=y;
run;


Accepted Solutions
Solution
‎03-26-2013 10:29 AM
Grand Advisor
Posts: 9,748

Re: Log scale yaxis

Documentation says, at least for my 9.2.3 install, that when the VALUES option is used then MINOR is ignored. You might try the MIN and MAX to control range of values displayed.

View solution in original post


All Replies
SAS Super FREQ
Posts: 1,044

Re: Log scale yaxis

Its working in my SAS 9.3 install.  Here is the graph.  Note the spacing of the values on the Y axis.  Default LOGSTYLE is LINEAR.  You can change that to LOGEXPAND or LOGEXPONENT.  Log will work as long as all the values are > 0.

SGPlot.png

Minor only works for LOGEXPAND and LOGEXPONENT, and you need more data range.  Here I scaled Y by 10:

SGPlot.png

Occasional Contributor
Posts: 8

Re: Log scale yaxis

thanks Sanjay!

I have a SAS 9.2, it works when including logstyle=logexpan, but how to show the y-axis scale range (e.g. from 0.1 to 100) and how to show the minor tick in the x-axis?

thanks

muyi

Occasional Contributor
Posts: 8

Re: Log scale yaxis

OK, it works now in my SAS 9.2 but the minor tick does not show in the x-axis, any suggestion?

data a;
input x y;
datalines;
0 31
20 694
40 783
60 824
80 511
100 341
;
run;

proc sgplot data=a;
xaxis label='x' values=(0 to 100 by 20) minor;
yaxis label='y' values=(1 to 1000) type=log logbase=10 logstyle=logexpand minor;
series x=x y=y;
run;

SAS Super FREQ
Posts: 1,044

Re: Log scale yaxis

Minor only works with Log (LogExpand and LogExponent) and Time axis.  Minor is not supported for linear axis in 9.2 and 9.3.  It will be in 9.4.

Solution
‎03-26-2013 10:29 AM
Grand Advisor
Posts: 9,748

Re: Log scale yaxis

Documentation says, at least for my 9.2.3 install, that when the VALUES option is used then MINOR is ignored. You might try the MIN and MAX to control range of values displayed.

Occasional Contributor
Posts: 8

Re: Log scale yaxis

Thanks all for the hlep.  I love this community.  

Post a Question
Discussion Stats
  • 6 replies
  • 1430 views
  • 0 likes
  • 3 in conversation