turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- ODS and Base Reporting
- /
- X-axis labeling with two lables in same graph

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-13-2016 11:27 AM

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).

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-13-2016 11:56 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-13-2016 12:01 PM

Hi,

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-13-2016 12:12 PM

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

Thanks,

Satish

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-13-2016 10:23 PM

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