BookmarkSubscribeRSS Feed
Kastchei
Pyrite | Level 9
I have tried Googling and searching the SAS documentation, but I cannot find any syntax to create a semi-log or log-log plot. Can anyone point me in the right direction?

Thanks!
12 REPLIES 12
Cynthia_sas
SAS Super FREQ
Hi:
This LOG-LOG example shows SGPLOT and PROC LOGISTIC is in the LOGISTIC doc: http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_logistic_sect065.htm

When I search support.sas.com using the string:
LOG-LOG plot

I get at least 20 hits....(the one above is the first hit -- the plot is at the very bottom of the page).

cynthia
Kastchei
Pyrite | Level 9
Thanks. I think when I was searching, I was just searching the SAS forums, which is why I was coming up with no hits.
Kastchei
Pyrite | Level 9
This is the type of graph I am trying to construct, where the x-axis is linear, but the y-axis is log-transformed:

http://en.wikipedia.org/wiki/File:600px-LogLinScale.png

I took at look at the links from the search, and I found a paper that mentioned this:

http://www2.sas.com/proceedings/sugi31/191-31.pdf

Page 3 states "The most common form of transformation is the logarithmic transform, to produce a log-linear or log-log graph. Producing a pretty logarithmic graph is not easy with SAS/Graph because of the difficulty of controlling the scale and tick mark labels. (The Annotate facility provides a mechanism for solving that problem.)"

However, it does not explain how one can use Annotate to properly create these graphs. Are there any resources?
Cynthia_sas
SAS Super FREQ
Hi: SUGI 31 was back in 2006 -- way before SAS 9.2 and the SG procedures.

As for ANNOTATE, there is another SUGI 31 paper that shows an example of ANNOTATE with a log axis:
http://www2.sas.com/proceedings/sugi31/085-31.pdf
and, more recently, this 2009 paper discusses some techniques for handling uneven axes:
http://support.sas.com/resources/papers/proceedings09/192-2009.pdf

Perhaps one of the SG experts or SAS/GRAPH experts has some other ideas or more advanced examples, since I do know you can do a LOG axis with the SGPLOT procedure.

cynthia
Kastchei
Pyrite | Level 9
Thank you for the resources. They are much appreciated. I have been able to use them for several other graphs I am working on. I also was given this link from a colleague from a listserv which addresses the log plots, for anyone else that might need it:

http://support.sas.com/kb/25/505.html
DanH_sas
SAS Super FREQ
Hey,

GTL and SGPLOT/SGPANEL support three types of log axes:

1. LOGEXPAND -- the classic style where the major ticks are placed at the cycle boundaried and the minor ticks at the in-between values.
2. LOGEXPONENT -- the style where the powers are placed on the axis (much like the one in the wikipedia link in this thread).
3. LINEAR -- the style where the linear values are placed at non-uniform intervals over the range of the data.

The documentatoin should have more details and pictures of the axes.

As Cynthia mentioned, there is also the facility for a linear axis to specify uneven intervals in a value list and have them place correctly along the linear axis.

Thanks!
Dan
Kastchei
Pyrite | Level 9
Thanks again. This information was equally helpful, and I was able to produce some very attractive graphs. I am now noticing two issues using SGPLOT.

1. When using ODS PDF, my titles and footnotes (defined by title1, etc) are appearing twice, once as expected on the page and once within the plot graphic. This issue does not occur with ODS HTML.

2. When using ODS PDF, the escape-char code ^{lastpage} prevents the graphic from displaying. The titles and footnotes appear in the PDF file, but the graphic that has the actual plot is missing. If I remove ^{lastpage} from the title, the graphic appears fine. ^{thispage} works correctly.

Any thoughts?
Cynthia_sas
SAS Super FREQ
Hi:
The duplicate titles/footnotes is a known problem:
http://support.sas.com/kb/34/600.html

I believe that there are also issues using ESCAPECHAR with ODS PDF and SAS/GRAPH. This is the only specific note I could find:
http://support.sas.com/kb/5/681.html

You may have to work with Tech Support on question #2.

cynthia
Kastchei
Pyrite | Level 9
Thanks. As an update, I have used the work-around for the titles issue. For the {lastpage} function, tech support says that unfortunately it will not be fully functional until SAS 9.3 and that currently the only option is not to use it: http://support.sas.com/kb/34/573.html.

Thanks very much for all your help today.
Kastchei
Pyrite | Level 9
A long delayed follow-up question:

I am creating several Log-Linear plots using SGPLOT. Is there any way to ensure that the Log axis (yaxis type = log logstyle = linear) has the same range across all graphs? That is, all graphs show major ticks to 25000 as opposed to just 6000 for some, 16000 for others, 22500 for more still, etc.

Thanks. Message was edited by: Kastchei
DanH_sas
SAS Super FREQ
There are a couple of things to try, depending on your situation:

1. Set MIN and MAX on the statement with TYPE=log

2. If you are using a BY group, you may be able to use UNIFORM=SCALE on the SGPLOT statement

Let me know if either of these give you what you want.

Thanks!
Dan
Kastchei
Pyrite | Level 9
Thanks Dan for the tips. I was skeptical about the min and max, because the documentation says this only works with linear and time axes. However, specifying max = 25000 did indeed produce LOG-LINEAR plots where the log axes had a maximum of 25000 for each plot.

Thanks!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 12 replies
  • 8418 views
  • 0 likes
  • 3 in conversation