BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
davehalltwp
Quartz | Level 8

I'm trying to specify values for the y axis from 0 at the top to -2 where it meets the x axis.  I can't seem to please Mr. SAS.

 

When I do this:

axis1 label=(a=90 h=12pt 'Threshold (log10 sec)')                                                                                                        
      order=(0 to -2 by 0.2) /*(-2 to 0.0 by 0.2)*/;                                                                                                        
 axis2 label=(h=12pt 'Session') order=(1 to 10 by 1) minor=none; 

 I get this in the log:

  
23         GOPTIONS ACCESSIBLE;
24         axis1 label=(a=90 h=12pt 'Threshold (log10 sec)')
25               order=(0 to -2 by 0.2) /*(-2 to 0.0 by 0.2)*/;
WARNING: Order= clause on the axis statement is not valid. The default axis values will be used.
26          axis2 label=(h=12pt 'Session') order=(1 to 10 by 1) minor=none;

When I do this, the log is clean but instead of printing '0' at the top, it prints "-2..7756E-16" in place of the "0" (all the other numbers on the scale appear as I want them). 

 

axis1 label=(a=90 h=12pt 'Threshold (log10 sec)')                                                                                                        
      order=/*(0 to -2 by 0.2)*/ (-2 to 0.0 by 0.2);                                                                                                        
 axis2 label=(h=12pt 'Session') order=(1 to 10 by 1) minor=none; 

 

So what's the secret?  I simply want this along my Y axis:

 

0

 

-.2

 

-.4

 

-.6

 

-.8

 

-1.0

 

(all the way to -2.0)

 

1 ACCEPTED SOLUTION

Accepted Solutions
davehalltwp
Quartz | Level 8

I ended up following Reeza's advice (about how SGPLOT is easier and more flexible) from a few days ago, and doing this plot with SGPLOT rather than GPLOT.  For some reason the XAXIS and YAXIS statements, where I specified the scaling, are much more responsive and easier to use than what I was trying to do for GPLOT.

 

Thanks, Reeza.

 

 

proc sgplot data = prep2;
   where trtn = 1;     
   styleattrs datacontrastcolors=(red);
   series x=session y=thresh / group=usubjid grouplc=trt name='grouping' lineattrs=(pattern=solid);
   keylegend 'grouping' / type = marker;
   xaxis values = (1 to 10 by 1); 
   yaxis values= (0 to -2 by -.2);
   title1 h=8pt color=black font='courier' J=L "&titlel1";
   title2 h=8pt color=black font='courier' J=L "Protocol: &titlel2 													Page 1 of 2";
   title5 h=8pt color=black font='courier' J=C "&titlel5";
   title6 h=8pt color=black font='courier' J=C "&titlel6";
   title7 h=8pt color=black font='courier' J=C "Placebo &titlel7";
   run;

View solution in original post

3 REPLIES 3
collinelliot
Barite | Level 11

I don't know how the other options you have might affect it, but at a very basic level you're using the right syntax. Try eliminating all but the order to get it to work and then add them back in to see what's breaking it.

 

data plot_data;
    do y = -2 to 1 by .2;
       x = ranuni(4);
       output;
    end;
run;

axis1 order = (-2 to 0 by .2);

proc gplot data = plot_data;
    plot y * x / vaxis = axis1;
run;
Reeza
Super User

Well, 0 to -2 by 0.2 isn't possible so that's a perfectly valid error, it would need to be by -0.2 (positive versus negative).

 

If it's not displaying have you applied a format? Or tried a Values instead?

 

 

davehalltwp
Quartz | Level 8

I ended up following Reeza's advice (about how SGPLOT is easier and more flexible) from a few days ago, and doing this plot with SGPLOT rather than GPLOT.  For some reason the XAXIS and YAXIS statements, where I specified the scaling, are much more responsive and easier to use than what I was trying to do for GPLOT.

 

Thanks, Reeza.

 

 

proc sgplot data = prep2;
   where trtn = 1;     
   styleattrs datacontrastcolors=(red);
   series x=session y=thresh / group=usubjid grouplc=trt name='grouping' lineattrs=(pattern=solid);
   keylegend 'grouping' / type = marker;
   xaxis values = (1 to 10 by 1); 
   yaxis values= (0 to -2 by -.2);
   title1 h=8pt color=black font='courier' J=L "&titlel1";
   title2 h=8pt color=black font='courier' J=L "Protocol: &titlel2 													Page 1 of 2";
   title5 h=8pt color=black font='courier' J=C "&titlel5";
   title6 h=8pt color=black font='courier' J=C "&titlel6";
   title7 h=8pt color=black font='courier' J=C "Placebo &titlel7";
   run;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1216 views
  • 0 likes
  • 3 in conversation