Programming the statistical procedures from SAS

plot using SGPLOT with Series statement for Semilog scale

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

plot using SGPLOT with Series statement for Semilog scale

Hi,

I got the below message when used SGPLOT with Series statement to create PK graph. 

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.

it is not creating the y-axis in log scale. 

 

Below is the code I used.

proc sgplot data=pkmean dattrmap=test noborder ;

   series x = pktime1 y =meancmax/ group=column attrid=X markers;

   xaxis label = 'Time (hr)' values = (0 to 60 by 10) minor MINORCOUNT=1;

   yaxis label = 'Concentration (ng/mL)' values = ( 1 10 100 1000 10000)  type=log logbase=10 logstyle=logexpand ;*   minor MINORCOUNT=8 ;

   keylegend / title="Concentration Vs. Time" location=inside position=TOPRIGHT across=1 down=2 noborder;

run;

 

Please let me know if you are aware of resolving this issue.

 

Thanks


Accepted Solutions
Solution
‎02-13-2018 07:58 PM
SAS Super FREQ
Posts: 4,237

Re: plot using SGPLOT with Series statement for Semilog scale

This is a data issue. One of your observations have meancmax=0.

You can use

WHERE meancmax > 0;

to plot only the valid values, or change the scaling on your Y axis.

 

To illustrate, run the following program. The NOTE appears. However, change the first DO loop to "do group=1 to 3" and the NOTE will no longer appear.

 

data A;
do group = 0 to 3; /* change to 1 to 3 to make NOTE go away */
do x=1 to 60;
y = group*x**2;
output;
end;
end;
run;

proc sgplot data=A noborder;
series x=x y=y / group=group markers;
xaxis label = 'Time (hr)' values = (0 to 60 by 10) minor MINORCOUNT=1;
yaxis label = 'Concentration (ng/mL)' values = ( 1 10 100 1000 10000)
type=log logbase=10 logstyle=logexpand ;* minor MINORCOUNT=8 ;
keylegend / title="Concentration Vs. Time" location=inside position=TOPRIGHT across=1 down=2 noborder;
run;

 

View solution in original post


All Replies
PROC Star
Posts: 1,258

Re: plot using SGPLOT with Series statement for Semilog scale

Haven't seen your data, so I can't tell you if this is the only problem..

 

But when you use values = (0 to 60 by 10) in the XAXIS Statement and also use type=log in the YAXIS Statement you are effectively asking SAS to take log10(0), which is not defined.

Solution
‎02-13-2018 07:58 PM
SAS Super FREQ
Posts: 4,237

Re: plot using SGPLOT with Series statement for Semilog scale

This is a data issue. One of your observations have meancmax=0.

You can use

WHERE meancmax > 0;

to plot only the valid values, or change the scaling on your Y axis.

 

To illustrate, run the following program. The NOTE appears. However, change the first DO loop to "do group=1 to 3" and the NOTE will no longer appear.

 

data A;
do group = 0 to 3; /* change to 1 to 3 to make NOTE go away */
do x=1 to 60;
y = group*x**2;
output;
end;
end;
run;

proc sgplot data=A noborder;
series x=x y=y / group=group markers;
xaxis label = 'Time (hr)' values = (0 to 60 by 10) minor MINORCOUNT=1;
yaxis label = 'Concentration (ng/mL)' values = ( 1 10 100 1000 10000)
type=log logbase=10 logstyle=logexpand ;* minor MINORCOUNT=8 ;
keylegend / title="Concentration Vs. Time" location=inside position=TOPRIGHT across=1 down=2 noborder;
run;

 

New Contributor
Posts: 3

Re: plot using SGPLOT with Series statement for Semilog scale

Hi Rick,
It worked. I appreciate your timely help.

Thanks,
Syam
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 185 views
  • 1 like
  • 3 in conversation