Overlaying positive and negative column charts with a line chart in SAS® Visual Analytics
- Article History
- RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
You can display both positive and negative values for a time period (year) when displaying the number of new members and canceled members.
At the same time, you can add a line chart to view the trend of the total number of members, as shown in the image below.
You can use a chart to visualize this data by creating a custom graph template in SAS® Graph Builder, which you can then use in a SAS Visual Analytics report.
To visualize the data, complete the following steps:
1) Build a custom graph template.
SAS Graph Builder enables you to create custom graph templates, which you can use in SAS Visual Analytics reports. In your graph template, you can change the layout, add new graph elements, modify data roles, change options, and so on.
To use SAS Graph Builder, from menu on the left pane, select Build Custom Graphs.
In order to create the graph above, the template consists of two bar charts and a line chart.
a) Select [New Custom Graph].
b) From the Elements menu on the left pane, drag the [Bar Chart] option twice and the [Line Chart] option once.
c) Click the Options menu on the right pane and select [Line Chart] from the drop-down list. Then, in the Y axis field, click Right.
d) Save the graph template as PN_Bar&Line.
2) Prepare the sample data.
After building a graph template, you need to make sure that your data will work with it. You might choose to do either of the following:
- Use existing data.
- Create data using the SAS code provided below to load the data into SAS® Cloud Analytics Services (CAS).
DATA pnbarline;
RETAIN totmem 100000;
DO i=1 TO 20;
newmem=1000*i;
cancel=(500*i)*-1;
totmem=totmem+500*i;
_year=2003+i;
year=mdy(12,31,_year);
OUTPUT;
END;
DROP i _year;
FORMAT year year4.;
RUN;
3) Import the custom graph and build a graph in SAS Visual Analytics.
From the menu on the left pane, click Explore and Visualize to move to SAS Visual Analytics. In order to use the custom template in SAS Visual Analytics, you need to import the template by completing the following steps:
a) On the objects pane, click. Then, click Import custom graph and select your custom graph.
b) Choose the sample data and assign the roles as follows:
The output should look similar to the following: