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

Dear  SAS users,

 I am trying to make a graph with a break on the Y axis. I am analyzing costs subdivided by different categories. The x axis is discrete and shows a scatter with the mean for each group of observations.

I have used ranges but it does not work. I receive this error: "ERROR 79-322: Expecting a -."
I am using the SAS 9.4 version. Could anybody please let me know what am I doing wrong?

Thank you.

proc means data=wneuro9 (where=(DMF ne '' AND  Admgroup =0)) mean noprint;
  class DMF;
  var ACT_TOTAL_COSTad;
  output out= costmean(where=(_type_ eq 1) rename=(DMF=GPRG))
  mean   =  mean ;
run;

data combined;
  format Mean 6.  ;
  set costmean(keep=GPRG mean) wneuro9(where=(DMF ne '') keep=DMF ACT_TOTAL_COSTad);
run;

ods graphics / reset width=5in height=3in ;
proc sgplot data=combined noborder noautolegend;
	styleattrs axisbreak=bracket;
 		scatter x=dmf y=ACT_TOTAL_COSTad / jitter clusterwidth=0.8 
          markerattrs=(symbol=plus size=5) transparency=0.8;
			yaxis  ranges=(min - 60000 230000 - max);
		highlow x=GPRG low=mean high=mean / nofill type=bar barwidth=0.4;
  		xaxis type=discrete labelattrs=(size=9) display=(noline noticks nolabel);
  		yaxis  ranges=(min - 60000 230000 - max)labelattrs=(size=9) display=(noline noticks) grid label='COST';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

The AXISBREAK option is availabe as of SAS 9.4 TS1M3 -> is your version TS1M3 or higher? 

If not, that means it will not work. 

 

 

Are you intending to have two YAXIS statements as well?

 


@Giampaolo wrote:

Hi Reeza,

Apologies for making it more difficult, here is the log.

Thank you

Giampaolo


 

View solution in original post

13 REPLIES 13
Reeza
Super User

Post the log please, it usually indicates where the error is. 

Giampaolo
Obsidian | Level 7

Hi Reeza,

Apologies for making it more difficult, here is the log.

Thank you

Giampaolo

Reeza
Super User

The AXISBREAK option is availabe as of SAS 9.4 TS1M3 -> is your version TS1M3 or higher? 

If not, that means it will not work. 

 

 

Are you intending to have two YAXIS statements as well?

 


@Giampaolo wrote:

Hi Reeza,

Apologies for making it more difficult, here is the log.

Thank you

Giampaolo


 

Giampaolo
Obsidian | Level 7
How do I know if the version I have is TS1M3 ?
Reeza
Super User

proc product_status;run;

Giampaolo
Obsidian | Level 7
For Base SAS Software ...
Custom version information: 9.4_M1
Image version information: 9.04.01M1P120413
For SAS/STAT ...
Reeza
Super User

So your version does not support the AXISBREAK option, so you need to remove it for now and try your code again. 

 

Personally, for developing SAS graphs, start with the minimal necessary code, just your scatter and plot statements first. Then start adding the options to make it look good after you've verified your data is plotting correctly. 

Giampaolo
Obsidian | Level 7

Yes the data plotted correctly when I did not attempt breaking the Y axis.

So is there a solution for previous SAS versions? Do I need to change the template?

Reeza
Super User

The axis will break, you don't have control over how it looks though. 

 


@Giampaolo wrote:

Yes the data plotted correctly when I did not attempt breaking the Y axis.

So is there a solution for previous SAS versions? Do I need to change the template?


 

Giampaolo
Obsidian | Level 7
All right.
Thank you!
Giampaolo
Obsidian | Level 7

I included two YAXIS statement because I thought that having scatter and highlow superimposed would require adjusting the axis twice. I did not have the chance to verify if this was correct because I did not get any output both with one and two YAXIs statements

ballardw
Super User

Only one YAXIS or XAXIS will apply so having multiple statements is not needed and may result in the procedure not using the "best" one.

 

If you want a separate appearing axis a YAXIS2 or XAXIS2 to show a different axis on the other side of the graph with different options may be appropriate.

Giampaolo
Obsidian | Level 7
Thank you.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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