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.
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.
Here's a screen capture of the graphs in the Word document:
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;
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
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.
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.
Ready to level-up your skills? Choose your own adventure.