The SAS Output Delivery System and reporting techniques

X-axis labeling with two lables in same graph

Reply
Contributor
Posts: 59

X-axis labeling with two lables in same graph

Hi all,

I am looking for help in creating graphs with two sets of labeling for X-axis. I am attaching my excel sheet, SAS code and the graphs I had generated. Basicially I want two X-axis labeling (Independent Studies and Studies) in the same graph. If you look at my SAS code, for two different graphs, X axis is Studies and Independent Studies. My data is the same and graphs generated are the same. However, I want tow X-axis labels in the same graph (Studies and Independent Studies).Fig 1.jpegFig 1_New.jpeg

 

Thanks for all the help,

Satish

ods listing close;
ods graphics / reset width=600px height=400px imagename='Fig 1' imagefmt=jpeg;
ods html file='Surg.html' path='E:\HRM\Revised\Revised18_New' style=journal; 

/*ods html file='ap.html' path='C:\' style=journal; */
 proc sgplot data=graphs;
 scatter X=Studies Y=MP /  markerattrs=(color=blue symbol=CircleFilled size=8) name="scat" legendlabel="Motor Pattern";
 series X=Studies Y=MP /  lineattrs=(color=blue pattern=1) ;
scatter X=Studies Y=BP /  markerattrs=(color=red symbol=SquareFilled size=8) name="scat1" legendlabel="Body Pattern";
 series X=Studies Y=BP /  lineattrs=(color=red pattern=1) ;
scatter X=Studies Y=OutOb /  markerattrs=(color=green symbol=TriangleFilled size=8) name="scat2" legendlabel="Achalasia/ Outflow obstruction";
 series X=Studies Y=OutOb /  lineattrs=(color=green pattern=1) ;

 XAXIS TYPE = DISCRETE ;
 YAXIS LABEL = '% Accuracy'    VALUES = (0 TO 100 BY 10);
keylegend "scat" "scat1" "scat2"  "scat4"  / position=bottomleft
across=1 location=inside ;
 run;
ods html close;
ods listing;


ods listing close;
ods graphics / reset width=600px height=400px imagename='Fig 1_New' imagefmt=jpeg;
ods html file='Surg.html' path='E:\HRM\Revised\Revised18_New' style=journal; 

/*ods html file='ap.html' path='C:\' style=journal; */
 proc sgplot data=graphs;
 scatter  X=Independent_Studies Y=MP /  markerattrs=(color=blue symbol=CircleFilled size=8) name="scat" legendlabel="Motor Pattern";
 series  X=Independent_Studies Y=MP /  lineattrs=(color=blue pattern=1) ;
scatter  X=Independent_Studies Y=BP /  markerattrs=(color=red symbol=SquareFilled size=8) name="scat1" legendlabel="Body Pattern";
 series  X=Independent_Studies Y=BP /  lineattrs=(color=red pattern=1) ;
scatter  X=Independent_Studies Y=OutOb /  markerattrs=(color=green symbol=TriangleFilled size=8) name="scat2" legendlabel="Achalasia/ Outflow obstruction";
 series X=Independent_Studies Y=OutOb /  lineattrs=(color=green pattern=1) ;

 XAXIS TYPE = DISCRETE ;
 YAXIS LABEL = '% Accuracy'    VALUES = (0 TO 100 BY 10);
keylegend "scat" "scat1" "scat2"  "scat4"  / position=bottomleft
across=1 location=inside ;
 run;
ods html close;
ods listing;
Super User
Posts: 10,500

Re: X-axis labeling with two lables in same graph

I can't tell if you are asking for two different axis labels for one graph, in which case look at the X2AXIS statement or two similar graphs with different Xaxis labels, which might be SGPanel.

 

I don't normally open Excel files but there wasn't any graph in yours so it doesn't help to answer appearance questions.

Contributor
Posts: 59

Re: X-axis labeling with two lables in same graph

Fig 1.jpegFig 1_New.jpegHi,

Thanks for the quick reply. Yes, I am looking for two different axis labels for one graph. I attached the graphs as image (it was attached to the body of the text). If u see in the Figure 1, I have X- axis as Studies. I also want Independent Studies (in excel sheet) as X-axis label. Can you please help me with the X2AXIS sas code?

 

Thanks,

Satish

Contributor
Posts: 59

Re: X-axis labeling with two lables in same graph

Hope this PDF attachment helps in communicating what I am looking for (2 X-axis lables in one graph).

 

Thanks,

Satish

Super User
Posts: 9,681

Re: X-axis labeling with two lables in same graph

Can you post it at ODS Graphic forum, not this forum .
Try  using X2AXIS statement.



Ask a Question
Discussion stats
  • 4 replies
  • 445 views
  • 0 likes
  • 3 in conversation