BookmarkSubscribeRSS Feed
arenavino
Calcite | Level 5

hi, 

i am trying to plot exponential of concentration vs time using proc gplot.  my program works fine when i just plot concentrations vs. time, but for the exponential values (that range from 1 to 6.8688813E94) i get the following error (my y-axis range from 0 to 1.0E99):

 

ERROR: Invalid Operation.
ERROR: Termination due to Floating Point Exception

 

Can anyone please suggest some work around it/

 

Thank you.

5 REPLIES 5
ballardw
Super User

Show the entire code you are using. You may have options that conflict with trying to display a range with 99 zeroes in the result...

arenavino
Calcite | Level 5

Below is the code:

data afinal;
set inds2;
aval=exp(CONC);
yvar=aval;
keep usubjid ntpt trt01pn yvar aval bloqfl conc;
run;

ods graphics on / reset=all;
ods graphics on / imagefmt=jpeg ;

goptions reset=all;
goptions nodisplay;
goptions htext=1 colors=(black) ftext="Courier" ftitle="Courier" gsfmode=replace device=pdfc;

OPTIONS ORIENTATION=landscape LEFTMARGIN="1 in" RIGHTMARGIN="1 in" TOPMARGIN="1 in" BOTTOMMARGIN=".5 in";

symbol1 interpol=j cv=blue line=1 mode=include;
symbol2 interpol=none h=1.5 v=circle c=blue mode=include;

axis1 label=(a=90 "concentration") order=(0 to 1.0E99 by 1.0E10) value=( h=1.1) minor=none length=10.3cm ;
axis2 label=("Time from First Dose (hrs)") order=(-0.5 to 176 by 😎 offset=(2,2) length=16cm major=none minor=none split="~"
value=( h=1.0);

**following is run per subject;
goptions reset=legend;

proc gplot data=AFINAL(where=(usubjid eq "1001")) gout=work.example1;
by subject subtrt;
plot yvar*ntpt = trt01pn/ vaxis=axis1 haxis=axis2 name="plot_1" noframe nolegend ;
plot2 aval*ntpt = trt01pn/ vaxis=axis1 noaxis name="plot_1" noframe nolegend;
run;
quit;

goptions display;
ods listing close;
ods pdf file="testplot.pdf" notoc ;

ods pdf startpage=yes;

proc greplay nofs tc=sashelp.templt template=whole ;
igout=work.example1;
treplay 1:plot_1;
run;
quit;
ods pdf close;
ods listing;

ballardw
Super User

I get this error message from your AXIS1 statement:

 

33   axis1 label=(a=90 "concentration") order=(0 to 1.0E99 by 1.0E10) value=( h=1.1) minor=none
33 ! length=10.3cm ;
ERROR: Unable to allocate sufficient memory. At least 2097152K bytes were requested, but only
       786430K were available. You must either increase the amount of memory available, or
       approach the problem differently.
WARNING: List has exceeded maximum length. The statement will be ignored.
WARNING: Order= clause on the axis statement is not valid. The default axis values will be used.
WARNING: The statement will be ignored.

You may want to try using SGPLOT which has different approach to axis definitions or move to a logarithmic axis. An example from the documentation may give you another way than an ORDER option that isn't working:

axis2 logbase=10
      logstyle=expand
       label=(angle=90 h=2 color=black
             "Concentration (Moles/Liter)" )
      value=(tick=1 "10" height=1.2 "-14"
             tick=2 "10" height=1.2 "-13"
             tick=2 "10" height=1.2 "-13"
             tick=3 "10" height=1.2 "-12"
             tick=4 "10" height=1.2 "-11"
             tick=5 "10" height=1.2 "-10"
             tick=6 "10" height=1.2 "-9"
             tick=7 "10" height=1.2 "-8"
             tick=8 "10" height=1.2 "-7"
             tick=9 "10" height=1.2 "-6"
             tick=10 "10" height=1.2 "-5"
             tick=11 "10" height=1.2 "-4"
             tick=12 "10" height=1.2 "-3"
             tick=13 "10" height=1.2 "-2"
             tick=14 "10" height=1.2 "-1")
              offset=(3,3);

Note explict value labels. The height above is basically used to generate a fake sort of superscript for the exponent. Obviously you would be using the exponents you want.

 

or don't use and order clause at all and let SAS pick the tickmarks.

 

arenavino
Calcite | Level 5

thank you for your help.  By leaving out the Order clause i get the graph but i can't control the y-axis range. My code generates one graph per subject and would like the same scale for each subject. 

ballardw
Super User

I've spent some time on this and then realized I had not tried the obivous:

See if this order clause works for you:

 

order=( 0, 1E10,1E20,1E30, 1E40, 1E50,1E60,1E70,1E80,1E90,1E99)

 

I think the issue with the memory exception was the to and by as that runs some sort of internal loop in the compilation of the Axis statement and probably hit any of a number of boundary problems.

 

You will get a not about uneven axis tickmarks.

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
  • 5 replies
  • 6344 views
  • 2 likes
  • 2 in conversation