BookmarkSubscribeRSS Feed
mnithinshetty
Obsidian | Level 7

Hi,

 

I am generating graph using proc template. Customers want graph to be in log scale axis.

So I am using the below line of code in proc template to generate a log scale in X axis and Y axis.

xaxisopts=(label=("<xaxis label>.") type=log logopts=(base=10 tickintervalstyle=logexpand viewmin=0 viewmax=100 tickvalueformat=ratio.).

Then I am formating log scale axis values to 0,1,2,3 as per requirement.

The reference line is to be drawn at 3 for X axis and 2 for Y axis. this is possible in a normal scale graph using referenceline statement proc template.

When I use log scale axis , how do I draw a reference line which is aligning to log scale. I am not very clear how reference line statement behave with log scale axis. 

Could you please suggest.

Please see the attachment.

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Many of us will not download Microsoft Office documents because they are a security threat. Please include whatever you are trying to show us directly in your reply, and not as an attachment.

--
Paige Miller
GraphGuy
Meteorite | Level 14

Here's a screen capture of the graphs in the Word document:

 

log_graph.png

GraphGuy
Meteorite | Level 14

Is there any particular reason you're using a custom template? If not, I would recommend using the standard Proc SGplot. Here's an example (using random data, since I don't have your data):

 

data foo;
do loop = 1 to 200;
 x=ranuni(123)*3;
 y=ranuni(123)*3;
 output;
 end;
run;

 

title "Log plot, with reflines at x=3 and y=2";
proc sgplot data=foo;
scatter x=x y=y;
xaxis values=(0.01, 1, 2, 3) type=log;
yaxis values=(0.01, 1, 2, 3) type=log;
refline 3 / axis=x lineattrs=(pattern=dot color=gray88);
refline 2 / axis=y lineattrs=(pattern=dot color=gray88);
run;

 

log_plot.png

DanH_sas
SAS Super FREQ

The values specified on the REFLINE statement are treated as LINEAR values, not LOG values. If your goal to put a reference line at LOG(3), then you will need to calculate the value of LOG(3) and use that value on the reference line.

 

Hope this helps!

Dan

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2093 views
  • 2 likes
  • 4 in conversation