I am trying to create a log graph using proc template. I have zero value in some variables. when I run the following I am getting a note
The log axis cannot support zero or negative values for the axis from plot data or due to default or assigned BASELINEINTERCEPT value. The axis type will be changed to
LINEAR.
I tried options changing the values from zero to 1 (@rick_sas), I am still getinng the same note. Any advise on this please. I used proc template so far. So I was comfortable using. if no option left may be will go with SGPLOT( new to this).
data mean;
input trtan time mean sd;
cards;
1 0 0 0
1 1 2.5 0.8
1 3 5 1.6
1 6 10 3.2
2 0 0 0
2 1 2.8 0.7
2 3 3.3 1.2
2 6 5.3 1.4
;
run;
data mean1;
set mean;
lower = MEAN - sd;
upper = MEAN + sd;
if mean=0 then do;
mean=.;
sd=.;
end;
run;
ods path(prepend) work.templat(update);
proc template;
define statgraph series;
begingraph/ BORDER=False datasymbols=( circle Asterisk) ;
layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;
layout overlay / xaxisopts=( label=('time') tickvalueattrs=(family='Courier New' size=8 ) labelattrs=(family='Courier New' size=8 )
linearopts=( viewmin=1 viewmax=6 tickvaluesequence=( start=1 end=6 increment=1)))
yaxisopts=( label=('time)') labelattrs=(family='Courier New' size=8 ) tickvalueattrs=(family='Courier New' size=8 )
type=log
linearopts=( viewmin=1 viewmax=10 tickvaluesequence=( start=0.0 end=10 increment=1)));
seriesplot x=time y= MEAN / group=sex name='series' display=(markers) connectorder=xaxis ;
scatterplot x=time y= MEAN / yerrorupper = upper yerrorlower = lower group=trtan name='scatter';
discretelegend 'series' / opaque=false border=true halign=right valign=top displayclipped=true across=2 order=rowmajor location=inside titleattrs=(family='Courier New' size=8 );
endlayout;
endlayout;
endgraph;
end;
run;
ods graphics on/ width=9 in height=4.6 in ;
options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline
noquotelenmax ;
ods escapechar = '^';
ods results on;
ods listing close;
ods rtf file = "\&location\chk1.rtf"
style = rtf nogtitle nogfootnote;
proc sgrender data=mean1 template=series;
run;
ods rtf close;
ods listing close;
Hello,
PROC SGPLOT is far "easier" than PROC TEMPLATE.
I would make "standard" plots with PROC SGPLOT (PROC TEMPLATE is absolutely "overkill" for "standard" plots).
Anyway, I guess your "lower" is still <= 0.
lower, mean and upper need to be > 0 to be able to use them on a log axis.
Koen
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.